【发布时间】:2012-01-02 12:30:00
【问题描述】:
我只是想问一下,当我按下回车键时,如何阻止我的 html 文本框刷新。
<div id="topSearchBox">
<input id="Text1" type="text" value="search..."/>
<img id="topSearchBoxIcon" alt="search buttom" src="~Images/Search-32x32.png" width="18px" height="18px" />
</div>
我有一个脚本告诉它做其他事情,但是在脚本完成后它会刷新页面。
$(document).keyup(function (e) {
if (e.keyCode == 13) { // enter
Search();
}
});
我已经阅读了一些内容,但似乎没有任何效果。
【问题讨论】:
标签: html textbox enter page-refresh