E021 - alex1221/bootlint-customization GitHub Wiki
当使用Bootstrap的 button.js jQuery组件的单选按钮或多选按钮组样式时, 您必须确保 <label> 在其DOM被加载时预选或预选的选项添加了 .active 类。只有这样,Bootstrap 才会正确地渲染以响应用户交互。
错误的:
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="checkbox" checked /> Option 1 (pre-checked)
</label>
<label class="btn btn-primary active">
<input type="checkbox" /> Option 2 (not pre-checked)
</label>
</div>正确的:
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="checkbox" checked /> Option 1 (pre-checked)
</label>
<label class="btn btn-primary">
<input type="checkbox" /> Option 2 (not pre-checked)
</label>
</div>错误的:
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="radio" name="options" id="option1" checked /> Option 1 (preselected)
</label>
<label class="btn btn-primary active">
<input type="radio" name="options" id="option2" /> Option 2 (not preselected)
</label>
</div>正确的:
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="radio" name="options" id="option1" checked /> Option 1 (preselected)
</label>
<label class="btn btn-primary">
<input type="radio" name="options" id="option2" /> Option 2 (not preselected)
</label>
</div>