Detecting the clicked links after ajax load in Chrome using $("a:focus")
I have a page which has a list item, and each item has a delete button. Clicking the delete button loads the child page (delete.asp?id=123) in a hidden div.
delete.asp has a javascript alert (on document ready) which succe开发者_StackOverflowssfully fires when the button is clicked. It also has $("a:focus").hide(); which removes clicked link. I can't seem to get this to work in Chrome. The alert fires but the link doesn't remove itself.
Besides using a:focus, is there a better way to do this?
Rather than removing the link from the loaded page, you should probably be removing it in the same event that loads the hidden page. Something like this:
$('a.delete').click(function() {
//load delete.asp
$('#myHiddenDiv').load('delete.asp?id=123');
//hide the link
$(this).hide();
});
精彩评论