asp.net - getting container element with jquery -


i'm using asp.net repeater control output following markup:

<div class="detailsitem"> <table style="width:100%;border: solid green 1px"> <tbody> <tr> <td colspan="3" style="text-align: right"> <a href="javascript:edititem($(this).closest('.detailsitem'));">edit</a> </td> </tr> </tbody> </table> </div> 

i thought code $(this).closest('.detailsitem') give me containing div. if alert on what's passed edititem, javascript code showing up. not sure comes from. i've tried various combinations of .parent etc no luck.

i found this post similar, didn't seem me out. i'm assuming problem might function call.

what missing?

many thanks, always!

you need use class anchors in repeater

<a href="javascript:void(0);" class="edit">edit</a> 

in ready event, attach click event handler anchor's:

$(".edit").live("click",function(){ var cur = $(this); edititem(cur.closest("div.detailsitem")); }); 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -