<input type="text"  />

$('input').on('input propertychange', function() {
  console.log('打印');
});

 

 

延伸知识:

1、回车提交绑定:

标签上添加:onfocus="document.onkeydown = ifFocus" onblur="document.onkeydown = null;"

如:<input type="text" id="userId" placeholder="请输入你要查询的用户ID" onfocus="document.onkeydown = ifFocus" onblur="document.onkeydown = null;" />

相关脚本:

function ifFocus(){
  var e = event || window.event || arguments.callee.caller.arguments[0];
  if(e && e.keyCode==13){
    alert('按了回车');
  }
}

 

posted on 2015-09-30 17:54  小老虎网络  阅读(439)  评论(0编辑  收藏  举报