html

<input class="left comName" type="search"/>

注意点:这里的type要为search
js  

$(".comName").keydown(function(e){
        var merNo=sessionStorage.getItem("merNo");
        console.log("merNo="+sessionStorage)
        if (!e)
            e = window.event;// 火狐中是 window.event
        if ((e.keyCode || e.which) == 13) {
            var comName=$(this).val();
            alert("comName="+comName);
            console.log(e.target)
        }
 });

然后我们就可以在
if ((e.keyCode || e.which) == 13){}
写点击搜索键的逻辑了^_^

 

相关文章:

  • 2021-10-30
  • 2021-12-09
  • 2021-09-18
  • 2021-09-16
  • 2021-06-18
  • 2021-12-05
  • 2021-10-17
  • 2021-11-03
猜你喜欢
  • 2021-11-22
  • 2021-09-16
  • 2021-11-03
  • 2021-09-16
  • 2021-12-28
  • 2021-10-17
  • 2021-09-27
  • 2021-08-29
相关资源
相似解决方案