javascript - Prevent page postback when user hits enter -
i have web form when user hits enter, page posted back. here's thing: when user clicks on form, control focused (my mouse pointer changes 1 when click input control) , when enter hit, page reload.
is there way capture press of key not mattering user clicks on?
//jquery example: //bind keypress function of input tags $("input").keypress(function (evt) { //deterime our character code coming within event var charcode = evt.charcode || evt.keycode; if (charcode == 13) { //enter key's keycode return false; } });
Comments
Post a Comment