.step
单击div 时,我正在尝试复制div .delete
。.delete
复制的 div 应显示在单击div的步骤下方
<div class="step" >
<h2> sth </h2>
<div class="copy"></div>
<div class="delete"></div>
</div>
<div class="step" >
<h2> sth </h2>
<div class="copy"></div>
<div class="delete"></div>
</div>
<div class="step" >
<h2> sth </h2>
<div class="copy"></div>
<div class="delete"></div>
</div>
这是我错误的 jQuery:
$('.copy').click(function(){
var newDiv = $(this).parent().innerHTML;
$(this).parent().after(newDiv);
});