jQuery focusout() example

jQuery focusout() function is used to bind an event handler to the "focusout" JavaScript event.


$(selector).focusout( handler )
handler -A function to execute each time the event is triggered.
$(selector).focusout( [eventData ], handler )
eventData - An object containing data that will be passed to the event handler. handler - A function to execute each time the event is triggered.


Watch for a loss of focus to occur inside paragraphs and note the difference between the focusout count and the blur count. (The blur count does not change because those events do not bubble.)
<!doctype html>
<html lang="en">

    <meta charset="utf-8">
    <title>focusout demo</title>
        .inputs {
            float: left;
            margin-right: 1em;

        .inputs p {
            margin-top: 0;
    <script src="https://code.jquery.com/jquery-3.4.1.js"></script>


    <div class="inputs">
            <input type="text"><br>
            <input type="text">
            <input type="password">
    <div id="focus-count">focusout fire</div>
    <div id="blur-count">blur fire</div>

        var focus = 0,
            blur = 0;
            .focusout(function() {
                $("#focus-count").text("focusout fired: " + focus + "x");
            .blur(function() {
                $("#blur-count").text("blur fired: " + blur + "x");


Try it Yourself - Copy paste code in Online HTML Editor to see the result