I am trying to hook into a link in a gridview with jquery but the grid is in an update panel and not visible until the user runs a report. If I add the class “.myLink” to any other “a” tag it works fine, but as the gridview is not there at document.ready I am not sure where to call this from
$(document).ready(function(){
$('a .myLink').click(function(){
var link = $(this).attr('href');
alert(link);
return false;
});
});
You can use
.live()to handle events on element created at any time, like this:If you have the container that it’ll appear in, and it doesn’t get replaced, you can use
.delegate()to be more efficient, like this: