全选才可以提交

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;}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章