input监听

<h1>
    实时监测input中值的变化
</h1>
<input type="text" id="username" autocomplete="off">
<div id="result"></div>
$(function() {
    $('#username').bind('input propertychange', function() {
        $('#result').html($(this).val().length + ' characters');
    });
})

 

posted @ 2017-08-07 13:02  壁虎漫步.  阅读(119)  评论(0编辑  收藏  举报