使用JQuery取消选择/取消聚焦输入字段 [英] Deselect/Unfocus input field using JQuery
问题描述
可能重复:
Jquery取消焦点
有没有办法使用JQuery取消选择/取消聚焦输入字段?类似 $(输入#名称)。select()。focus();
但是相反?
Is there a way to deselect/unfocus an input field using JQuery? Something like $("input#name").select().focus();
but in reverse?
推荐答案
.blur();
参考: http://api.jquery.com/blur/
绑定模糊JavaScript事件的事件处理程序,或触发元素上的事件。
...此方法是...的快捷方式code> .trigger(模糊) ...
...This method is a shortcut for... .trigger( "blur" )
...
模糊
事件在失去焦点时发送给元素。最初,此事件仅适用于表单元素,例如< input>
。在最近的浏览器中,事件的域已扩展为包括所有元素类型。元素可能会通过键盘命令失去焦点,例如Tab键,或者通过鼠标点击页面上的其他位置...
The blur
event is sent to an element when it loses focus. Originally, this event was only applicable to form elements, such as <input>
. In recent browsers, the domain of the event has been extended to include all element types. An element can lose focus via keyboard commands, such as the Tab key, or by mouse clicks elsewhere on the page...
这篇关于使用JQuery取消选择/取消聚焦输入字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!