js 实时监听input中值变化


<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>RunJS</title>
	<script id="jquery_183" type="text/javascript" class="library" src="/js/sandbox/jquery/jquery-1.8.3.min.js"></script>
	</head>
	<body>
		<h1 >
			实时监测input中值的变化
		</h1>
		<input type="text" id="username" autoComplete='off'>
		<div id="result"></div>
	</body>
</html>



$(function(){

$('#username').bind('input propertychange', function() {
    $('#result').html($(this).val().length + ' characters');
});

})

  

$(document).ready(function () {
    $('#phonenum,#verifycode').bind('input propertychange',$('#verifycode').bind('input propertychange'), function(){
        btnSwitch()
        btnApplySwith()
    })
})

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM