views:

47

answers:

2

I'm using jquery $.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 with $.ajax but after load data when i fire any event on then it's not working so how to possible to access these row Please provide me solution for this problem

+6  A: 

Use jQuery.live,refer to here:http://api.jquery.com/live/

It will bind events to dynamically loaded dom.

Best,

samer
A: 

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

andres descalzo