views:

366

answers:

1

Hello,

I'm very new to JQuery so this will probably sound ridiculous but I have a form that repopulates data via AJAX into a div section. The problem I'm having is that I have a link where I need to access some table row attributes that get rendered to the page during the AJAX refresh but the attributes are all undefined according to my alerts I set up. Does anyone know how I can access that data again in livequery? Below is the code.

//Rebind anchor tags for add links.
$('a[class=add_player]') 
    .livequery('click', function(event) { 

    var parentRow = $(this).parent().parent();    
    //Pulling player information from table row tag 
    var playerID = parentRow.attr("player_id");  //playerID is 'undefined' when alerted.

    refreshPlayer(playerID);
});

HTML

<tr player_id="123">
   <td><a class="add_player">Tester</a></td>
</tr>
+1  A: 

The way I have this working is this, abandoning livequery() for the now native live():

$('a[class=add_player]').live('click', function(event) { 
    var playerID = $(this).closest('tr').attr('player_id');                  

    alert(playerID);

    refreshPlayer(playerID);
    return false;
});
artlung