Javascript Form How to - Remove focus from the Reset button








Question

We would like to know how to remove focus from the Reset button.

Answer


<!--from w w w. ja v  a  2 s  .co m-->
<html>
<body>
    <script language="JavaScript">
    function showMsg(){
         console.log("Focus removed from the Reset button.");
    }
    </script>
    <form name="form1">
        Enter Name: <input type="text" Name="name" Size=15>
        <br>
        Enter Phone: <input type="text" Name="phone" Size=10>
        <br>
        <input type="reset" name=resetbutton value=Reset onBlur='showMsg()'>
        <br>
        <br>
    </form>
</body>
</html>

The code above is rendered as follows: