I need your help in my code. I have a problem when a new div is inserted from jquery the inserted div is not applicable to my jquery code, if anyone has a solution, please tell me this my HTML too
<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>
and this jquery code
$(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; }) })
early
source share