jQuery focusout()Method

jQuery 事件方法jQuery Event Methods

Example

When the <div> element or any child element within it loses focus, set the background color of the <div> element:

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

Try it Yourself »

Definition and Usage

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

The focusout() method attaches a function to run when a focusout event occurs on the element, or any element inside it.

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

Tip:This method is usually used together withfocusin()method.


Syntax

$(selector).focusout(function)

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


jQuery 事件方法jQuery Event Methods

Other Extensions