Bootstrap 不使用“已检查"复选框的属性 [英] Bootstrap doesn't use "checked" attribute of checkbox

查看:17
本文介绍了Bootstrap 不使用“已检查"复选框的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Bootstrap.我有一个表格,在标题和每个列中都有一个复选框.我正在尝试在 jQuery 上创建检查所有"功能,但引导程序似乎不使用已检查的属性.正如我所见,它在我的复选框周围添加了 span 标记,并向其添加了一个已选中"的类.有没有可能使用checked attr,或者我必须忘记它并编写类检查和切换?

下面是结果 HTML 的部分代码:

<div class="checker"><span class=""><input type="checkbox" class="payout_check" style="opacity: 0;"></span>

</td>

这是未经检查的.选中它,第三行变为:

解决方案

取消勾选此项工作

jQuery('span', $('#uniform-You_id_checkbox')).removeClass("checked");$('#You_id_checkbox').removeAttr("checked");

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?

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆