Easy Tutorial
❮ Traversing Prev Html Toggleclass ❯

jQuery focusout() Method

jQuery Event Methods

Example

Set the background color of a <div> element when it or any of its child elements lose focus:

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

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 an element or within it.

Unlike the blur() method, the focusout() method is also triggered when any child element loses focus.

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


Syntax

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

jQuery Event Methods

❮ Traversing Prev Html Toggleclass ❯