H-ui JQuery 给单选按纽赋值不生效
$("#sex-1").attr('checked',true)
原因,iradio-blue 样式的原因
把下面代码注释掉就可以了
$('.skin-minimal input').iCheck({ checkboxClass: 'icheckbox-blue', radioClass: 'iradio-blue', increaseArea: '20%' });
<div class="formControls col-xs-8 col-sm-9 skin-minimal"> <div class="radio-box"> <div class="iradio-blue"><input type="radio" name="sex" value="1" id="sex-1" checked="checked" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins></div> <label for="sex-1" class="">男</label> </div> <div class="radio-box"> <div class="iradio-blue checked"><input type="radio" name="sex" value="2" id="sex-2" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins></div> <label for="sex-2" class="">女</label> </div> </div>