【问题标题】:Is it possible to have single checkbox for multiple values to the below design? [closed]是否可以为以下设计设置多个值的单个复选框? [关闭]
【发布时间】:2020-10-28 13:21:18
【问题描述】:

我已经尝试在互联网上搜索,但找不到合适的解决方案,谁能帮助我

【问题讨论】:

  • 您在 Google(或任何其他搜索引擎)上搜索过什么?请编辑您的问题以包含该内容。
  • 请在描述中给出详细信息。不是问题的标题
  • 我找不到设计代码,但是我找到了“一个复选框同时选中或取消选中许多其他复选框”的解决方案,我已经知道了。

标签: css checkbox checkboxlist


【解决方案1】:

好的...所以您只想要 CSS...请检查以下代码并根据您的大小和需要进行调整

input[type='checkbox'] {
  width: 90px;
  height: 90px;
  background: white;
  border-radius: 5px;
  border: 2px solid #555;
}
<input style="float:left;" type="checkbox" />
<label class="form-check-label"><br>First line <br> Second line <br> third line</label>

【讨论】:

  • 完美!非常感谢它的工作
【解决方案2】:

我不确定这是否可能。但是,您可以使用一个复选框同时选中或取消选中许多其他复选框。你可以使用下面的代码来做到这一点

$('#selectAllBoxes').click(function(event) {
  if (this.checked) {

    $('.checkBoxes').each(function() {
      this.checked = true;
    });
  } else {
    $('.checkBoxes').each(function() {
      this.checked = false;
    });
  }
});
&lt;input class="checkBoxes" type="checkbox" name="selectAllBoxes" id="selectAllBoxes"&gt;

【讨论】:

  • 我知道这个功能,我只需要上面设计的css。顺便说一句,感谢您的解决方案。
猜你喜欢
  • 2010-11-07
  • 2020-12-23
  • 2021-05-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-05-08
相关资源
最近更新 更多