HTML
<div class="weui-cell"> <div class="weui-cell__hd"><label class="weui-label">性别</label></div> <div class="weui-cell__bd"> <input class="weui-radio"name="sex"type="radio"value="1"style=" 18px;height: 18px;vertical-align: text-bottom;margin-bottom: 2px;">男 <input class="weui-radio"name="sex"type="radio"value="2"style=" 18px;height: 18px;vertical-align: text-bottom;margin-bottom: 2px;margin-left: 12px">女 <!--<input type="radio" name="n" hidden=""> <input type="radio" name="n" hidden="">--> </div> </div>
取值:
let identity = $('input:radio[name=identity]:checked').val();
let sex = $('input:radio[name=sex]:checked').val();
回显:
let identity =obj.identity; let sex =obj.sex; $(":radio[name='identity'][value='" + identity + "']").prop("checked", "checked"); $(":radio[name='sex'][value='" + sex + "']").prop("checked", "checked");