首页 > 设计 > WEB开发 > 正文

全选才可以提交

2019-11-02 18:31:56
字体:
来源:转载
供稿:网友

HTML代码如下:

<div class="gas"> <i class="iconfont icon-qititance"></i> <p class="makeupGas">补充气体储存量</p> <i class="iconfont">&#xe612;</i> </div> <div class="gas"> <i class="iconfont icon-guandaoshutong"></i> <p class="pipelineMaintenance">水管已经维修</p> <i class="iconfont">&#xe612;</i> </div>

js代码如下:

$('.gas i:last-child').on("click",function(){ $(this).toggleClass('color');//判断是否有color,如果没有就加上,有就删除 for(var i = 0; i < $('.gas i:last-child').length; i ++){ if(!$('.gas i:last-child').eq(i).hasClass('color')){ state = 1; $('.finish').addClass('disabled'); break; } } if(i == $('.gas i:last-child').length){ state = 0; $('.finish').removeClass('disabled'); }})

CSS代码里要有一个color{color:green;}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表