输入框输入完后,点击回车触发查询按钮

<input id="source_name" type="text" placeholder="请输入资源名称" />
<button id="query">查询</button>

若要在上面的输入框输入完信息后,点击回车触发查询按钮,则如下操作:

$("#source_name").keydown(function(e){
    if(e.keyCode == 13){
    	$("#query").click(function () {
    		myfunc();
    	}
    }
});
发布了101 篇原创文章 · 获赞 69 · 访问量 22万+

猜你喜欢

转载自blog.csdn.net/weekdawn/article/details/103674514
今日推荐