Return to Snippet

Revision: 29271
at July 24, 2010 05:40 by smithbjames


Updated Code
$('.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
			}
		});

Revision: 29270
at July 24, 2010 05:38 by smithbjames


Initial Code
		$('.no-enter').keypress(function(e){	//Stop certain forms from submitting on enter
			if(e.which == 13){
				e.preventDefault();
				alert('no enter');
			}
		});

Initial URL

                                

Initial Description

                                

Initial Title
Prevent Enter from Submitting Form (jQuery)

Initial Tags
form, javascript, textmate, jquery

Initial Language
jQuery