javascript - livequery behaving strangely for dynamically added elements -
when use following, see divs static , dynamic 1 one including dynamically added div #xyz
jquery('div').livequery(function() { alert($(this).attr("id") + " div added") })
but when use
jquery('#xyz').livequery(function() { alert($(this).attr("id") + " div added") })
i nothing. - if xyz in static html, above works.
eventually want able click button programmatically when added dynamically.
any appreciated.
just use jquery.live. attach event handler elements match selector , in future.
example
$('a.foo').live('click', function() { alert('clicked!'); });
i don't know if can catch event, when new elements added dom, in general want apply behaviour (when event occurs) them anyway.
Comments
Post a Comment