jQuery Blur Event

The blur event runs when a focused element loses focus. It is often used for lightweight validation after the user leaves a field.

Syntax Top ↑

$( selector ).on( "blur", function (event) {
    // The element has lost focus.
});

Check Required Fields After Blur Top ↑

$( function () {
    $( "#t1" ).on( "blur", function () {
        const value = $( this ).val().trim();
        if ( value.length === 0 ) {
            $( "#d1" ).text( "Please enter your name" );
        }
    });

    $( "#t2" ).on( "blur", function () {
        const value = $( this ).val().trim();
        if ( value.length === 0 ) {
            $( "#d1" ).text( "Please enter your email" );
        }
    });
});

Open the blur-event demo →

Use focus for entry guidance and blur for checks that should happen when the user leaves the control.

Form Component Events with jQuery






plus2net.com






✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer