网页常用动态效果--多表单验证

 1         jQuery(document).ready(function($) {
 2             var arr = ['tel','email','qq','weichat'];
 3             $('input').each(function(index, el) {
 4                 $(this).val(arr[index]);
 5             });
 6             $('input').focus(function(event) {
 7                 //输入值不可为当前值
 8                 var index = $(this).index();
 9                 if($(this).val()==arr[index]){
10                     $(this).val(" ");
11                 }
12             }).blur(function(event) {
13                 var index = $(this).index();
14                 if($(this).val()==" "){
15                     $(this).val(arr[index]);
16                 }
17             });;
18 
19         });

 

posted @ 2015-09-24 10:11  十三君  阅读(193)  评论(0编辑  收藏  举报