JavaScript click doesn't work the second time
I have a jQuery script to delete a message. The first time I click the link everything works fine. I click the delete link and a confirm
d开发者_运维知识库ialog appears. Upon confirmation it redirects to another page and then back. However, the second time I click the link nothing happens.
$(document).ready(function(){
$("a.del").click(function(){
var conf = confirm("Confirmation message");
if(conf == true)
return true;
else
return false;
});
});
Click function must work every click event.
I did it by not writing into $(document).ready(function(){});
Like:
$("a.del").click(function(){
var conf = confirm("Confirmation message");
if(conf == true)
return true;
else
return false;
});
精彩评论