/ Published in: jQuery

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$('.no-enter').keypress(function(e){ //Stop form fields with class 'no-enter' from submitting the form when the user presses enter if(e.which == 13){ //Identifies the enter key as the key pressed e.preventDefault(); //Stops the enter key from performing default function alert('no enter'); //Put whatever you want to happen here } });
Comments
