js中设置值页面体现不出来的原因

<!DOCTYPE html>
<html lang="en">
 <head> 
  <meta charset="UTF-8" /> 
  <meta name="viewport" content="width=device-width,initial-scale=1 user-scalable=0" /> 
  <title>js中设置值页面体现不出来的原因</title> 
  <script src="./qrcodejs/jquery.min.js" type="text/javascript" charset="utf-8"></script> 
	<script>	
		$(document).ready(function(){
			//
			$("#btn").click(function(){
				alert('You click Me now!');
			});
			$("#container").html('<button type="button" id="btn">Click Me!</button>');
			//
			$("#yourname").val('liuchao');
			$("#content").html('<input type="text" id="yourname" name="yourname" size="30" maxlength="20" value="输入框的长度为30,允许最大字符数为20">');
		});
	</script>
  <style>
	*{
		margin:0px;
		padding:0px;
	}
	</style> 
 </head> 
 <body>
<div id="container"> 
  <button type="button" id="btn">Click Me!</button>
</div>
<div id="content">
	<input type="text" id="yourname" name="yourname" size="30" maxlength="20" value="输入框的长度为30,允许最大字符数为20">
</div>
 </body>
</html>

  

猜你喜欢

转载自www.cnblogs.com/hnhycnlc888/p/11096223.html