Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to block enter button for submitting the form using Javascript

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 254
    Comment on it

    Hello Reader! If you want your html form that block the pressing action of enter button and accept only submit button then you can see how its working in the example below :-

    $("FormSubmit").bind("keypress", function (e) {
        if (e.keyCode == 13) {
            $("#btnSearch").attr('value');
             return false;
        }
    });
    

    The logic behind this is to block the key having ASCII key code = 13.
    On call the form with 'Onsubmit' to this function, it will always block the key with ASCII 13.

 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: