首页 > 技术文章 > input框输入完回车即可查询事件

yxh1008 2017-03-12 14:54 原文

简单有效的方法,随笔记录一下
在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试试,也是一样的效果

 


推荐阅读