<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('按了回车');
}
}