I have the following code. When the user hits [ENTER] (keycode = 13), the form is being resubmitted. I'd like to prevent a postback in this condition. When I set the keycode equal to 0, it does nothing. The page postback is still occuring. How can I prevent the post postback?
jQuery(this.Elements.TxtClientId).keypress(function(e) {
if (e.keyCode == 13) {
e.keyCode = 0;
alert("keycode: " + e.keyCode);
thisTemp._internalClientId = jQuery(thisTemp.Elements.TxtClientId).val();
jQuery(thisTemp.Elements.DDLClientName).val(jQuery(thisTemp.Elements.TxtClientId).val());
thisTemp.UpdateTestDropdown();
}
});