jQuery确认在Chrome中不起作用 [英] jQuery confirmation not working in Chrome

查看:316
本文介绍了jQuery确认在Chrome中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个基本的确认框,当用户单击链接时,它会以简单的确认/取消提示用户.

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

这在FF和IE中正常运行,但是Chrome似乎忽略了它.

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.

推荐答案

我能够通过更改来自的初始jquery调用来解决类似的问题

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

$().ready(function() 

$(document).ready(function()

这篇关于jQuery确认在Chrome中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆