Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • HTML onblur event

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 246
    Comment on it

    This event will be fired when the element loses focus. Mostly it is used with the form validation code(e.g. with the input field in a form). onfocus event is the opposite to the onblur attribute.
    Syntax :

    <element onload="script">
    

    Example : HTML Code :

      <!DOCTYPE html>
        <html>
        <body>
        Name: <input type="text" name="fname" id="fname" onblur="onblurFunction()">
    <p>When you leave the input field, a function is fired which convert  the input text to  upper case. </p>
    </body>
        </html>
    

    Javascript Code :

    <script>
    function onblurFunction() {
        var x = document.getElementById("fname");
        x.value = x.value.toUpperCase();
    }
    </script>
    

    Output:
    When you leave the input field, a function is fired which convert the input text to upper case.
    e.g : if you enter any text(i.e mukesh) inside the input field, then it convert into upper case i.e. MUKESH

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: