2013-12-19 100 views

回答

1
$.event.special.focus = { 
    trigger: function(e){ 
     console.log(e); 
     return false; // if false, focus is not firing 
    } 
}; 

试试这个代码。

编辑由OP:

pushOK的代码为出发点,我需要。我需要达到我的目标详细在下面的评论是:

$.event.special.focus = { 
    trigger: function(e){ 
     e.preventDefault(); 
     return true; 
    } 
}; 
+0

我知道我可以做到这一点,谢谢。但那不是我想要的。我需要覆盖默认的焦点动作。 –

+1

@AndrewBullock你正在为之而行的行为是什么? –

+0

我有很多调用.focus()的代码。我想在移动设备上防止此元素聚焦,但我希望任何onfocus处理程序触发。 –