0
我想克隆只有内容的点击的div与相同的类,但不同的ID。已经尝试了几个答案,没有运气。 已尝试此功能 $(this).next('。pick')。clone()。appendTo('#four');克隆单个div的内容与同一类
这里是我作为一个例子。
<div id="one" class="pick">
One
</div>
<div id="two" class="pick">
Two
</div>
<div id="three" class="pick">
Three
</div>
<div id="four" class="pickfour">
Four
</div>
<script type="text/javascript">
$(document).ready(function() {
$(".pick").click(function(e){
e.preventDefault();
$(function(){
$(".pick", this).clone().appendTo('#four');
});
});
});
</script>
https://jsfiddle.net/4fk94xzz/请检查一下,如果这是你想要的 – guradio