jQuery confirmation not working in Chrome

青春壹個敷衍的年華 提交于 2019-12-12 00:01:57

问题


I'm trying to create a basic confirmation box which prompts users with a simple confirm/cancel when they click on a link.

This is working fine in FF and IE, however Chrome just seems to ignore it.

Can anyone see why this might not be working?

//Confirm Duplication        
$("a[href*=duplicate]").click(function(event){         
   var answer = confirm("Duplicate?")     
   if(!answer){
      event.preventDefault();    
   }
 });

Any advice appreciated. Thanks.


回答1:


I was able to fix a similar issue by changing the initial jquery call from

$().ready(function() 

to

$(document).ready(function()


来源:https://stackoverflow.com/questions/1555089/jquery-confirmation-not-working-in-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!