当前位置: 首页 > 工具软件 > jQuery WeUI > 使用案例 >

Jquery WeUI 复选框

甄阿苏
2023-12-01

html

	<div class="weui-cells__title ">製程</div>
    <div class="weui-cells weui-cells_checkbox" id="processSelect">

    </div>

展示JS

        var processHtml = [];
        $.each(data.processes,function(key, value){
            processHtml.push('<label class="weui-cell weui-check__label">');
            processHtml.push('<div class="weui-cell__hd">');
            processHtml.push('<input type="checkbox" class="weui-check" name="processBox" myTxt="'+value+'"');
            processHtml.push('id="process'+key+'" checked="checked">');
            processHtml.push('<i class="weui-icon-checked"></i>');
            processHtml.push('</div>');
            processHtml.push('<div class="weui-cell__bd">');
            processHtml.push('<p>'+value+'</p> ');
            processHtml.push('</div>');
            processHtml.push('</label>');
        });
        $('#processSelect').html(processHtml.join(''));

提交JS

		var process = '';
        $("input[name='processBox']").each(function(){
            if($(this).is(':checked')){
                process += $(this).attr('myTxt') + "-";
            }
        });
        if(!process||process.length===0){
            $.toptip('請選擇製程', 2000, 'warning');
            btnNoLoading("下一步");
            return;
        }
        if(process&&process.length>0){
            process = process.substring(0, process.length-1);
        }
 类似资料: