Return to Snippet

Revision: 57671
at June 5, 2012 06:20 by weldonr30


Initial Code
//prevent page submit on enter key press
//call the postback javascript then cancel the enter key press
$(document).keydown(function (e) {
	if (e.keyCode == 13) {
	__doPostBack('txtBox_TextChanged', '');
	return false;
	}
});

Initial URL

                                

Initial Description
13 is Enter key
return false cancels the postback
<p>In this case I am calling the javascript <strong>doPostBack and telling it to execute the txtBox<em>TextChanged method
brief tutorial on _</em>doPostBack here: <a href="http://aspalliance.com/895_Understanding_the_JavaScript___doPostBack_Function.all">http://aspalliance.com/895<em>Understanding_the_JavaScript___doPostBack_Function.all</a></p>

Initial Title
Stop Enter key (default submit method) & replace with specified method

Initial Tags

                                

Initial Language
jQuery