Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery focusout() method

jQuery focusout() method

jQuery event methods jQuery event methods

Example

When

When the element or any of its child elements lose focus, set
elements' background color:

$

(

"

div

"

)

.

focusout

(

function

(

)

{

$

(

this

)

.

css

(

"

background-color

"

,

"

#FFFFFF

"

)

;

}

)

;

Try it »


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 a focusout event occurs on an element or on any element within it.

The difference between blur() method, the focusout() method also triggers when any child element loses focus.

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


Syntax

$(

selector

).focusout(

function

)

Parameters Description
function Optional. Specifies the function to run when the focusout event occurs.

jQuery event methods jQuery event methods