开发者

jQuery confirmation not working in Chrome

开发者 https://www.devze.com 2022-12-08 21:17 出处:网络
I\'m trying to create a basic confirmation box which prompts users with a simple confirm/cancel when they click on a link.

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*=dupli开发者_JAVA百科cate]").click(function(event){         
   var answer = confirm("Duplicate?")     
   if(!answer){
      event.preventDefault();    
   }
 });

Any advice appreciated. Thanks.


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

$().ready(function() 

to

$(document).ready(function()
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号