English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery focusout() method

jQuery Events

The focusout() method is used to remove focus from the selected element.

andblur()method is different, the focusout() method will also trigger when any child element loses focus.

This method is usually used withfocusin()Methods can be used together.

Syntax:

Trigger the focus event of the selected element:

$.focusout()

Attach the function to the focus event:

$.focusout(function)

Instance

Trigger the focus event of <input>:

$("document").ready(function(){
  $("input").focusout().css("background-color", "white");
});
Test and see‹/›

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

$("div").focusout(function(){
  $(this).css("background-color", "white");
});
Test and see‹/›

Parameter Value

ParameterDescription
functionFunction executed when the focus event is triggered

jQuery Events