Thursday, August 13, 2015

How to detect when that enter key is pressed inside a TextBox or somewhere else ?

How to detect when that enter key is pressed inside a TextBox or somewhere else ?




$('form input').live("keypress", function(e) {
        if (e.keyCode == 13) {
//put your logic here
             alert('enter key has been pressed inside the textbook');
            return false; // prevent the button click from happening
        }
});


No comments:

Post a Comment