tags:

views:

44

answers:

1

I have this code right now to get the row value from jquery grid..

$("#table1").click(function(e) {
                var row = jQuery(e.target).parent();
                value = row.attr("id");

i need to loop all the rows to get the values cany anyone help me out.. that is if I click on second row I need get second row value if I click on first row I need to get first row value.

thanks

A: 

Try this:

$('tr', '#table1').live('click', function(){
    var id = $(this).attr('id');
});
Simeon
I would strongly recommend to use $('#table1').delegate('tr', 'click', function(){});
jAndy
Why? I cannot find any difference. Both binds click to the #table1 element and checks event target from there on.
Simeon
Actually, if you take a look at the jQuery 1.4.2 source code, on lines 2411-2413, the only thing that the delegate extension does is to call $.fn.live on the context.
Simeon