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