Search code examples
javascriptjqueryonblur

Detect when a user unfocuses on an input box using jQuery?


Is it possible to detect when the user unfocuses an input box using jquery? I.e when they click off of it an event fires.


Solution

  • I believe the blur function is what you are looking for.

    $( "input[type=text]" ).blur( function() {
        // unfocus event
    });