Solution 1:

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

$('#filter').blur(function() {
  $('#options').hide();
});

Solution 2:

Like this:

$(selector).focusout(function () {
    //Your Code
});

Solution 3:

Use "blur": http://docs.jquery.com/Events/blur#fn