javascript - HDI: Disable postback on html input box -
i have input box don't want postback occur on striking enter key
i want javascript event take place instead.
<input type="text" id="addressinput" onkeydown="inputenter()" autopostback="false"/> function inputenter() { if (event.keycode == 13) { seachlocations(); return false; } else { return false; } }
just return false form js function, add return false; @ end of function.
or <input type="text"
id="addressinput"
onkeydown ="return (event.keycode!=13)" autopostback="false"/>
update: how this..?
<asp:textbox id="textbox1" runat="server" onkeydown="return callenterkeyfunc(event.keycode);"> </asp:textbox> <script type="text/javascript"> function callenterkeyfunc(key) { if (key == 13) { //for ff, think have use evt.which //enter key press seachlocations(); return false; } else return true; } function seachlocations() { //your code alert("hello"); } </script>
Comments
Post a Comment