失去文本框焦点的事件 - Javascript

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5324736/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 16:48:33  来源:igfitidea点击:

Event to Lose focus of a TextBox - Javascript

javascriptjqueryhtml

提问by john

I need to remove focus from a textbox. if i need to set focus for a textbox we have .focus() method. Similarly is there any other method to remove focus from a textbox using javascript/jquery.

我需要从文本框中移除焦点。如果我需要为文本框设置焦点,我们有 .focus() 方法。同样,是否还有其他方法可以使用 javascript/jquery 从文本框中移除焦点。

回答by akc42

Just set the focus somewhere else

只需将焦点放在其他地方

回答by Sergiu Dumitriu

Yes, there's the DOM-HTML standard blur().

是的,有 DOM-HTML 标准blur()