input框输入完回车即可查询事件

简单有效的方法,随笔记录一下
在html设置id
<input id="search_sim" type="text" class="form-control w-xxl" ng-model="queryObj.search" >

然后再js中设置相应的绑定事件

$('#search_sim').bind('keypress',function(event){//监听sim卡回车事件
        if(event.keyCode == "13")    
        {  
            $scope.doSearchSim();
            $scope.refresh();
        }
    });

当然,可以将bind改为on试试,也是一样的效果


原文地址:https://www.cnblogs.com/yxh1008/p/6537902.html