Stop textbox causing postback
Hey. I've got an HTML textbox, but when I press enter, it causes a postback. I'd rather it either do nothing or 'click' a hyperlink anchor. How do I stop the textbox from causing a postback when the enter key is 开发者_运维知识库pressed? Tthanks
I have:
<input id="textbox" type="text" />
<a href="#">Locate</a>
Create a javascript onSubmit handler that returns false. E.g.
<form name="form1" onSubmit="return false;">
<input type="text" value="Parnsip, turnip" />
</form>
精彩评论