开发者

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜