[英]JavaScript click doesn't work the second time
I have a jQuery script to delete a message. 我有一个jQuery脚本来删除一条消息。 The first time I click the link everything works fine.
第一次单击链接时,一切正常。 I click the delete link and a
confirm
dialog appears. 我单击删除链接,然后出现
confirm
对话框。 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(){}); 我是通过不写$(document).ready(function(){})来实现的;
Like: 喜欢:
$("a.del").click(function(){
var conf = confirm("Confirmation message");
if(conf == true)
return true;
else
return false;
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.