码迷,mamicode.com
首页 > 其他好文 > 详细

判断文本框的取值

时间:2016-09-28 21:59:10      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:

 1 <!DOCTYPE html>
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5     <title></title>
 6     <script src="jq/jquery-3.0.0.min.js"></script>
 7 </head>
 8 <body>
 9     <input type="text" value="" id="a1" />
10     <input type="text" value="" id="a2" />
11     <input type="text" value="" id="a3" />
12     <input type="text" value="" id="a4" />
13     <input type="button" value="确定" id="a5" />
14     <script>
15         $(document).ready(function () {
16             $("input[type=‘button‘]").click(function () {
17                 //alert("为空")
18                 //数组
19                 var num = $("input[type=‘text‘]");
20                 var aaa = "";
21                 for (var i = 0; i < num.length; i++) {
22                     if (num.eq(i).val() == "") {
23                         aaa += "第" + i + "个文本框为空";
24                         //a+=b   相当于   a = a+b
25                     }
26                 }
27                 alert(aaa);
28             });
29         });
30     </script>
31 </body>
32 </html>

 

判断文本框的取值

标签:

原文地址:http://www.cnblogs.com/1412660554a/p/5917742.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!