Joe Joe - 2 months ago 17x
jQuery Question

jQuery lose focus event

I'm trying to show up a container if a input field gets the focus and - that's the actual problem - hide the container if focus is lost. Is there an opposite event for jQuery's focus?

Some example code:

<input type="text" value="" name="filter" id="filter"/>

<div id="options">some cool options</div>

<script type="text/javascript">

$('#filter').focus(function() {

And what I'd like to do is something like this:

$('#filter').focus_lost(function() {


Use blur event to call your function when element loses focus :

$('#filter').blur(function() {