我有四个链接,我希望内容出现在被点击的特定链接的链接列表下方的 div(.contentcont [name of div]) 中。
$('.link1').click(function(e){
$(this).clone().html('<h1>Text appear</h1>')
.appendTo('.contentcont')
e.preventDefault();
});
我正在使用 .html() 提供要输入到 div 的内容。如果您查看提供的 js fiddle ( http://jsfiddle.net/jack2ky/K3FaY/2/ ),您将能够看到新内容出现在 div 中,但它具有链接的特征[不好]。也许这与我使用 .clone() 有关。我使用 .clone() 的原因是,当我点击链接时,链接就会消失。也许您可以告诉我使用 .clone() 是否是防止链接消失的正确解决方案。为什么新内容具有链接特征?