defaultValue属性包含表单元素的初始值

 1     <script type="text/javascript">
 2         $(function(){
 3             $('input[type="text"]').focus(function(){
 4               $(this).val('');
 5             }).blur(function(){
 6               $(this).val(this.defaultValue);    
 7             });
 8             /*$('input[type="text"]').focus(function(){
 9             $(this).val('');
10             });
11             $('#address').blur(function(){
12             $(this).val($addressTxt);    
13             });
14             $('#password').blur(function(){
15             $(this).val($passwordTxt);    
16             });*/
17         });
18     </script>

 

posted on 2016-05-28 15:51  jasonduanmu  阅读(717)  评论(0编辑  收藏  举报

导航