Latest web development tutorials

jQuery focusin () method

jQuery Event Methods jQuery Event Methods

Examples

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

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

try it"

Definition and Usage

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

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

And focus () method is different, focusin () method when any sub-element receives the focus will be triggered.

Tip: When using the mouse to click on the selected element or elements positioned through the tab key, the element will be the focus.

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


grammar

$(selector).focusin(function)

参数 描述
function 必需。规定 focusin 事件发生时要运行的函数。


jQuery Event Methods jQuery Event Methods