Monday, September 1, 2014

Disable Enter key using javascript code

Here is the function to disable Enter keys using javascript code,  you have to paste this code and call this javascript method from your window onload method or using Jquery ready methods:


function DisableEnterKey(e) {
    var key;

    if (!e) {
        e = window.event;
    }

    if (e.keyCode) {
        key = e.keyCode;
    }
    else {
        key = e.which;
    }

    return (key != 13);
}


Happy Coding :) !!

No comments:

Post a Comment