Why doesn't jQuery .on() work with an AJAX loaded element? -
okay, i've managed .on
working on different site, reason being pain in one.
here code:
$("#tabsection").on("click", "a.tab", function () { alert('bob'); });
and html (which loaded via jquery .load()
:
<div id="tabsection"> <table border=0 width="750px" cellspacing=0 cellpadding=0> <tr><td class="tab"><a href="javascript:void();" rel="details" class="tab selected">details</a></td>
obviously close table , tabsection div. working fine before got loading via ajax. now, cant work @ all. suggestions why wouldnt be? missing here?
you loading #tabsection
element, means doesn't exist when try hook event.
the element hook event have exist when hook up. use element load html.
$("#customerform").on("click", "#tabsection a.tab", function () { alert('bob'); });
Comments
Post a Comment