jQuery blur | How to use blur method of jQuery as element loosed focus

jQuery blur method


Blur event happens when an element of HTML document loses focus by using mouse click or by using Tab key. At links (a href=””> the blur event occurs as its loses focus by using Tab key. Whereas in form fields like text boxes, text area etc. blur event occurs as Tab key is pressed out to other element or mouse is clicked somewhere else.

Syntax

$(selector).blur(function)

e.g.

$(“#txtbox”).blur(function)

$(“#link”).blur(function)

Running example of blur method

In example below blur event is captured in two elements, one is text box and other is link. To check link loosing focus (blur) use Tab key and for text box use either Tab or mouse click.

The text ahead of element will be shows as event occurs by using blur method of jQuery.

Experience this example online




Was this article helpful?

Related Articles

Leave A Comment?