jquery 获取输入框的值

node2:/var/www/html#cat a47.html 
<input type="text" id="address" value="请输入邮箱地址"/>
<input type="text" id="password" value="请输入邮箱密码"/>
<input type="button" value="登录"/>
<script type="text/javascript" src="jquery-2.2.2.min.js"></script>    
<script type="text/javascript" src="a47.js"></script>

node2:/var/www/html#cat a47.js
$("#address").focus(function(){
   var txt_value = $(this).val(); //获取地址文本框的值
   alert(txt_value);
  }
);


原文地址:https://www.cnblogs.com/hzcya1995/p/13349162.html