Bootstrap不使用“已检查"复选框的属性 [英] Bootstrap doesn't use "checked" attribute of checkbox
问题描述
我正在使用Bootstrap.我在标题和每个列中都有一个带有复选框的表.我试图在jQuery上使用全部检查"功能,但是引导程序似乎未使用已检查的属性.如我所见,它在我的复选框周围添加了span标签,并向其添加了一个"checked"类.是否有可能使用checked attr,还是我必须忘记它并编写类检查和切换?
I am using Bootstrap. I have a table with a checkbox in a header and in each collumn. I am trying to make "check all" functionality on jQuery, but it seems that bootstrap does not use checked attribute. As I see, it adds span tag around my checkbox and adds a class 'checked' to it. Is there any possibility to work with checked attr, or I must forget about it and write class checking and switching?
下面是结果HTML中的部分代码:
Below goes the part of code from the result HTML:
<td>
<div class="checker">
<span class="">
<input type="checkbox" class="payout_check" style="opacity: 0;">
</span>
</div>
</td>
这是未选中的.已选中,第三行更改为:
This is unchecked one. The it is checked, third row changes to:
<span class="checked">
推荐答案
此功能适用于取消选中状态
this work for uncheck
jQuery('span', $('#uniform-You_id_checkbox')).removeClass("checked");
$('#You_id_checkbox').removeAttr("checked");
这篇关于Bootstrap不使用“已检查"复选框的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!