有没有办法防止元素在 JavaScript/jQuery 中失去焦点? [英] Is there a way to prevent an element from losing focus in JavaScript/jQuery?
本文介绍了有没有办法防止元素在 JavaScript/jQuery 中失去焦点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
focusout/blur 事件仅在元素失去焦点后触发...顺便说一句,我更喜欢不使用插件来做到这一点.
The focusout/blur events fire only after the element loses focus... By the way, I prefer to do that without using plugins.
推荐答案
是的.你可以用这个:
<input type="text" onblur="this.focus();" />
或者在 jQuery 中:
Or in jQuery:
$(element).blur(function(){
$(this).focus();
});
这篇关于有没有办法防止元素在 JavaScript/jQuery 中失去焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文