jquery监听enter事件并执行相关函数
/**
* 监听并执行enter事件
* @param selector:选择器,多个之间用逗号隔开
* @fun:enter事件之后要执行的函数
*/
function pressEnter(selector,fun){
var selectors = selector.split(",");
$.each(selectors, function(){
$(String(this)).keydown(function(event){
if(event.keyCode==13){
fun();
}else{
return;
}
});
});
}
0
赞
- 所属分类: 前端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 openharmony
-
9、 golang