<div class="mui-input-row mui-radio mui-left moren"><label>设为默认</label><input name="radio1" type="radio" checked class="moren"></div>我使用的mui的单选组件当他触发点击事件$(document).on('click','.moren',function(){ $.post("http://1er/default_address",{userId:uid,id:$(this).attr('id')}, function (data) { })})触发点击事件后向后台发送一请求将这个设置为单选按钮,但是不管有多少个总是最后一个选中样式,大神指教改怎么改?
1 回答
陪伴而非守候
TA贡献1757条经验 获得超8个赞
是这个意思?
<div id="content">
<div class="mui-input-row mui-radio mui-left moren">
<label>设为默认</label>
<input name="radio1" type="radio" class="moren" id="r1">
</div>
<div class="mui-input-row mui-radio mui-left moren">
<label>设为默认</label>
<input name="radio1" type="radio" class="moren">
</div>
<div class="mui-input-row mui-radio mui-left moren">
<label>设为默认</label>
<input name="radio1" type="radio" class="moren">
</div>
</div>
// 选中最后一个
document.querySelector(".moren:last-child .moren").checked = "true";
添加回答
举报
0/150
提交
取消