我需要你在代码中的帮助。当我使用jQuery插入新的div时,插入的div不适用于我的jQuery代码。如果有人有解决方案,请告诉我。这是我的HTML代码:
<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;
})
})
感谢您的提前帮助。