weui weui-switch 开关取值,设置默认状态

html

                <div class="weui-cell__ft">
                    <input class="weui-switch" type="checkbox" id="btn-switch">
                div>

js

var str = $("#btn-switch").is(":checked");

注:选中返回值:true;未选中返回值:false

设置开关状态

默认开启

                <div class="weui-cell__ft">
                    <input class="weui-switch" type="checkbox" id="btn-switch" checked="checked">
                div>

默认关闭

                <div class="weui-cell__ft">
                    <input class="weui-switch" type="checkbox" id="btn-switch"/>
                div>

 

你可能感兴趣的:(weui weui-switch 开关取值,设置默认状态)