Home > Article > Web Front-end > How to use jQuery blur()
The jQuery blur() method is used to trigger the blur event. Its usage syntax is "$(selector).blur() $(selector).blur(function)". The parameter function indicates that it will run when the blur event occurs. The function.
The operating environment of this tutorial: windows10 system, jquery2.2.4, this article is applicable to all brands of computers.
Recommended: "jquery video tutorial"
jQuery blur() method
The blur event occurs when the element loses focus .
blur() method triggers the blur event, or specifies a function to run when the blur event occurs.
Tip: This method is often used together with the focus() method.
Syntax
Trigger blur event for selected elements:
$(selector).blur()
Add function to blur event:
$(selector).blur(function)
Parameters
function can select. Specifies the function to run when the blur event occurs.
Example
Add function to blur event. The blur event occurs when the d5fd7aea971a85678ba271703566ebfd field loses focus:
$("input").blur(function(){ alert("输入框失去了焦点"); });
Related free learning recommendations: JavaScript (video)
The above is the detailed content of How to use jQuery blur(). For more information, please follow other related articles on the PHP Chinese website!