<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>克隆</title>
<style>
.b1 {
height: 50px;
width: 100px;
background-color: gold;
color: red;
}
</style>
</head>
<body>
<button class="b1">屠龙宝刀,点击就送</button>
<script src="jquery-3.3.1.min.js"></script>
<script>
$(".b1").click(function () {
console.log(this);
// $(this).after($(this).clone());
$(this).clone(true).insertAfter(this);
})
</script>
</body>
</html>
jQuery克隆小例子
最新推荐文章于 2024-07-19 03:18:39 发布