我有一个来自rails的远程链接,它会生成这个html
<a href="/comments/154/remove" class="delete_event_comment" data-method="delete" data-remote="true" rel="nofollow">Delete</a>和要求确认的coffeescript
$('.delete_event_comment').click ->
confirm("Delete Comment: Are you sure?")它等同于下面的javascript
$('.delete_event_comment').click(function() {
return confirm("Delete Comment: Are you sure?");
});它在桌面上的safari上按预期工作:首先显示对话框,然后如果用户按cancel则什么也不做,如果用户按OK则发送ajax调用来删除注释
但在iphone safari中,它首先发送ajax调用,然后显示对话。有什么想法吗?
发布于 2012-08-10 09:11:07
我对咖啡脚本了解不多,但是..我会试着:
$('.delete_event_comment').click ->
return confirm("Delete Comment: Are you sure?")说明:返回false时,jQuery点击事件会切断链接的正常动作(或传播)。
https://stackoverflow.com/questions/11893347
复制相似问题