$(selector).clone(true|false)
参数 | 说明 |
true | 它指定还应复制事件处理程序。 |
false | 这是默认参数。它指定不应复制事件处理程序。 |
<!DOCTYPE html>
<html>
<head>
<script src="/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").clone().appendTo("body");
});
});
</script>
</head>
<body>
<p><b> bianchenghao6.com is a popular tutorial website.</b></p>
<p><b>bianchenghao6.com is a training institute also.</b></p>
<button>Click here, to clone all p elements, and append them to the body element</button>
</body>
</html>
bianchenghao6.com is a popular tutorial website.
bianchenghao6.com is a training institute also.