zoukankan      html  css  js  c++  java
  • WEUI switch 如何取值?

    let id =  $(this).attr("id");
                let name =  $(this).attr("data-name");

    HTML:

    <div id="codeList"><div class="weui-cell weui-cell_switch">
                                        <div class="weui-cell__bd">数据统计</div>
                                        <div class="weui-cell__ft">
                                            <label class="weui-switch-cp"><input class="weui-switch-cp__input" value="0002" id="0002" type="checkbox" checked="checked"><div class="weui-switch-cp__box"></div>
                                            </label>
                                        </div>
                                    </div><div class="weui-cell weui-cell_switch">
                                        <div class="weui-cell__bd">管理员</div>
                                        <div class="weui-cell__ft">
                                            <label class="weui-switch-cp"><input class="weui-switch-cp__input" value="0003" id="0003" type="checkbox" checked="checked"><div class="weui-switch-cp__box"></div>
                                            </label>
                                        </div>
                                    </div><div class="weui-cell weui-cell_switch">
                                        <div class="weui-cell__bd">用户画像</div>
                                        <div class="weui-cell__ft">
                                            <label class="weui-switch-cp"><input class="weui-switch-cp__input" value="0000" id="0000" type="checkbox" checked="checked"><div class="weui-switch-cp__box"></div>
                                            </label>
                                        </div>

    取值操作:

    functionCode = '';
        $(".weui-switch-cp__input").each(function(){
            if($(this).prop('checked')){
                functionCode = functionCode + $(this).val() + ",";
            }
        });
        if(functionCode.length > 0){
            functionCode = functionCode.substr(0, functionCode.length - 1);
        }
        obj.functionCode = functionCode;
  • 相关阅读:
    Linux Home目录硬盘空间缩减
    test
    ORACLE 数据泵 expdp/impdp
    mysql利用mysqlbinlog命令恢复误删除数据
    LogMiner日志挖掘分析管理
    Oracle 审计测试与总结
    redis 5.0.3 讲解、集群搭建
    联想服务器配置 RAID
    Cenots7对lvm逻辑卷分区大小的调整
    kvm 基本运维命令
  • 原文地址:https://www.cnblogs.com/zxyun/p/9330798.html
Copyright © 2011-2022 走看看