gpt4 book ai didi

Jquery 未选中带有单选按钮的复选框

转载 作者:行者123 更新时间:2023-12-01 07:23:59 37 4
gpt4 key购买 nike

使用 jQuery,我隐藏了所有复选框和单选按钮,并使用 CSS background 来指示主题状态。我想取消选中所有带有单选按钮的复选框,但我的实现不起作用,因为尽管 CSS 已更改,但我的复选框仍处于选中状态:

 var fliter_radio=$(".item input[name='group1_radio']");
var fliter_checkbox=$(".item input[name='group1']");

fliter_radio.next().click(function(){
$(this).prev()[0].checked=true;
$(this).addClass("checked");

//#unchecked all checkbox
fliter_checkbox.each(function(){
$(this).checked=false;
$(this).next().removeClass("checked");
})
})

<li class="item"><input type="radio" id="radio" name="group1_radio" checked="checked" value="unchecked" /><strong>radio button</strong></li>
<li class="item"><input type="checkbox" id="CheckBox1" name="group1" value="news" /><strong>Checkbox1</strong></li>
<li class="item"><input type="checkbox" id="CheckBox2" name="group1" value="news" /><strong>Checkbox2</strong></li>

我在这里重写了一个完整的演示:http://jsfiddle.net/badjohnny/MnujS/8/

你能帮我正确实现这个吗?

最佳答案

$(this).checked=false;$(this).prop("checked",false);

关于Jquery 未选中带有单选按钮的复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10827733/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com