html - jQuery to close a loaded div -
i load div post content external php page in <div> called #ajaxcontent when click table row in table #tblstudents this:
$("#tblstudents").on("click", "tr", function(e){ var row_id = $("td:first a.ajaxcall", this).attr("rel"); $("#ajaxcontent").html("<div id='wait'></div>"); $.ajax({ url: "/page/editstudent.php", data: { 'student_id':row_id }, success: function(data){ $("#ajaxcontent").html(data); } }); }); now want add close button inside loaded #ajaxcontentdiv.
works when add code outside #ajaxcontent div. hides div makes $("#tblstudents").on("click", "tr", function(e) stop working until full page refresh...
<button id='hide'>hide</button> <script> $("#hide").click(function(){ $("#ajaxcontent").hide(); }); </script> is possible add close function current jquery script? , still able toggle through #tblstudent- table rows , load #ajaxcontentwithout page refresh?
it seems issue if click hide button don't have show container on next row click.
just adding show() method elemnt within row click should resolve issue
$("#ajaxcontent").show().html("<div id='wait'></div>"); if visible show() not cause problems
Comments
Post a Comment