光标失去焦点、获得焦点、键盘绑定回车

// 元素获得焦点时,带事件。

$("input").focus(function(){
  //$("input").css("background-color","#FFFFCC");
});

//元素失去焦点时

eg:$("#id").blur();

 $("#id").blur(function(){

});

//--------------------------------------------------------------------------

$(document).keydown(function (event) {

// 回车绑定
if (event.keyCode === 13) {
}
});

posted @ 2020-04-22 11:55  就一个  阅读(252)  评论(0)    收藏  举报