---
title: "jquery 监听input输入值事件"
author: "javaCrazy！"
date: "2012-08-22T17:24:37Z"
tags: []
categories: ["Web前端"]
slug: "jquery-input"
draft: false
lastmod: "2012-08-22T17:24:37Z"
id: 1654811
url: "https://stelin.iteye.com/blog/1654811"
---

```
<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> 
```