我需要你的帮助,我的代码有问题,当从jQuery的 插入新的div插入DIV并不适用于我的jQuery代码,如果任何人有解决办法,请告诉我 这我的HTML代码如何在插入表单jQuery代码的div上运行我的jquery代码?
<input type="text" id="t" value=""/>
<a href="#" class="btn">click</a><br/>
<br/>
<div class="profileInfoSectionwall"style="border:1px solid #ccc">
text111111
<div class="remove" style="display: none;">
<a class="post_remove" rel="1" herf="#">X</a>
</div>
</div>
<br/>
<div class="profileInfoSectionwall"style="border:1px solid #ccc">
text222222
<div class="remove" style="display: none;">
<a class="post_remove" rel="2" herf="#">X</a>
</div>
</div>
和这个jQuery代码
$(document).ready(function(){
$(".profileInfoSectionwall").mouseenter(function(){
$(this).children(".remove").show();
});
$(".profileInfoSectionwall").mouseleave(function(){
$(".remove").hide();
});
$(".btn").click(function(){
var s=$("#t").attr("value");
$(this).after("<br/><br/><div class='profileInfoSectionwall' style='border:1px solid #ccc'>"+s+"<div class='remove' style='display: none;'><a class='post_remove' rel='3' herf='#'>X</a></div></div>");
return false;
})
})
在此先感谢
从jQuery 1.7开始,不推荐使用.live()方法。使用.on()附加事件处理程序。老版本的jQuery用户应优先使用.delegate(),而不要使用.live()。 http://api.jquery.com/live/ – arunes 2012-03-01 12:29:41
@Mona Abdelmajeed感谢这个解决方案与我一起工作,非常感谢 – 2012-03-01 12:31:23