i use jquery add html dom. after insertion create eventhandler called on keyup
, clicks on link added el
. however, jquery not find a
element added after loading page.
var el = $("#name"); // add content el $(document).keyup(function(e) { el.find('a').click(); });
how can update dom in el
? know there on()
(and predecessors) in jquery. however, not me event not registered on added element itself, on document , event happens on newly added element. ideas on how solve this?
thanks response of @johan doing further debugging , found solution:
el.find('a')[0].click();
so real problem not changing dom click()
event apparently can applied single element , not list of 1 element.
some further discussion click()
not firing can found here: can call jquery click() follow <a> link if haven't bound event handler bind or click already?
Comments
Post a Comment