ITPub博客

首页 > > > Jquery怎么循环遍历每个input框内容不能为空

Jquery怎么循环遍历每个input框内容不能为空

作者:oswald 时间:2019-09-27 14:29:39 0 删除 编辑

Jquery怎么循环遍历每个input框内容不能为空,并且正则验证必须为2-10个汉字,且给出对应的错误提示?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title> new document </title>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  <meta name="author" content="" />
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <link rel="stylesheet" type="text/css" href="" />
  <style type="text/css"></style>
  <script type="text/javascript" src="jquery-3.0.0.js"></script>
 </head>
 <body>
    <div>
            城市1:<input type="text" name="ceshi" class="eym" /><br /><br />
            城市2:<input type="text" name="ceshi" class="eym" /><br /><br />
            城市3:<input type="text" name="ceshi" class="eym" /><br /><br />
            城市4:<input type="text" name="ceshi" class="eym" /><br /><br />
            城市5:<input type="text" name="ceshi" class="eym" /><br /><br />
            城市6:<input type="text" name="ceshi" class="eym" /><br /><br />
    </div>
    <div style="">
        <input type="button" name="ceshi" value="提交" class="subcit" />
    </div>
    <script type="text/javascript">
        $(document).ready(function(){
        $(".subcit").click(function(){
        var city = $.trim($(".eym").val());
        
            });
    });
    </script>
 </body>
</html>


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2231/viewspace-3123791/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-04-16

  • 博文量
    137
  • 访问量
    1302