Home >Web Front-end >JS Tutorial >How to use jQuery blur()

How to use jQuery blur()

藏色散人
藏色散人Original
2020-11-10 11:18:332827browse

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.

How to use jQuery blur()

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn