I'm using jQuer开发者_运维百科y $.ajax to load my table row data like
<table id='row-data'>
<tr><td>1001</td></tr>
<tr><td>1322</td></tr>
<tr><td>1551</td></tr>
<tr><td>2341</td></tr>
</table>
In above code I load all <tr> with $.ajax
but after load data when I fire any event on <tr> then it's not working,
so how to possible to access these row?
Please provide me solution for this problem.
Use jQuery.live,refer to here:http://api.jquery.com/live/
It will bind events to dynamically loaded dom.
Best,
you can assign events live, but if you then remove the html with "empty", you must first remove the events assigned to live.
you can also use an update of the events this way:
var yourfunction = function(ev){
// ...
};
$.fn.updateEvent = function(fn) {
$(this).bind('click', fn);
};
$("#container").empty().load(...).updateEvent(yourfunction);
jquery.empty
jquery.live
jquery.die
加载中,请稍侯......
精彩评论