Latest web development tutorials

jQuery focusout () method

jQuery Event Methods jQuery Event Methods

Examples

When the <div> element or any child elements lost focus, set the background color of the <div> element:

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

try it"

Definition and Usage

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

When focusout event occurs on any element or elements therein, focusout () method to add the function to run.

And blur () method is different, focusout () method when any sub-element loses focus will be triggered.

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


grammar

$(selector).focusout(function)

参数 描述
function 可选。规定 focusout 事件发生时要运行的函数。


jQuery Event Methods jQuery Event Methods