jquery 监听input输入值事件
<html>
<head>
<title></title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
</head>
<script type="text/javascript">
$(function(){
//IE
if($.browser.msie){
$("#sno").get(0).attachEvent("onpropertychange",function (o){
alert(o.srcElement.value);
});
//非IE
}else{
$("#sno").get(0).addEventListener("input",function(o){
alert(o.target.value);
},false);
}
});
</script>
<body>
<input id="sno" value="">
</body>
</html>
监听一个keyup事件
问个问题: 假如用户在Input中输入了“12345”,但后来又删掉了“5”,那这种情况就监听不到了吧。这种情况该怎么达到时时监听的目的?