Home > Web Front-end > JS Tutorial > body text

The use and definition of jQuery focusout event

黄舟
Release: 2017-06-27 13:23:37
Original
1337 people have browsed it

Overview

Bind a handler function to the focusout event of each matching element.

This event is triggered when an element, or any element within it, loses focus. The difference between this and the blur event is that it can detect when the child element loses focus on the parent element.

Parameters

fnFunctionV1.0

The handler function bound in the focusout event of each matching element.

[data],fnString,FunctionV1.4.3

data:focusout([Data], fn) can pass in data for Function fn processing.

fn: The handler function bound in the focusout event of each matching element.

Example

Description:

Animation will be triggered after losing focus:

HTML code:

<p><input type="text" /> <span>focusout fire</span></p> <p><input type="password" /> <span>focusout fire</span></p>
Copy after login

jQuery Code:

$("p").focusout(function() { $(this).find("span").css(&#39;display&#39;,&#39;inline&#39;).fadeOut(1000); });
Copy after login

Example

When the

element or any of its sub-elements loses focus, set the background color of the
element:

$("div").focusout(function(){
$(this).css("background-color","#FFFFFF");
});
Copy after login

Definition and Usage

The focusout event occurs when an element (or any element within it) loses focus.

The focusout() method adds a function to run when the focusout event occurs on the element or any element within it.

Different from the blur() method, the focusout() method will also be triggered when any sub-element loses focus.

Tip: This method is usually used together with the focusin() method.

The above is the detailed content of The use and definition of jQuery focusout event. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!