$(‘#search_input‘).bind(‘keypress‘, function (event) { if (event.keyCode == "13") { //Search() event.preventDefault(); } });
或者利用form,但假若搜索函数里有跳转链接,一般要去掉form默认提交事件(return false;)
手机端搜索的回车事件
原文:https://www.cnblogs.com/cxd4321/p/15177396.html