I need helps. How to add default a checkbox in jplist. Example:
<input value="Anne Stokes" data-path="Anne Stokes" type="checkbox">
I want this default selected
答案 0 :(得分:1)
可以通过在输入中添加选中的属性来完成
<input value="Anne Stokes" data-path="Anne Stokes" type="checkbox" checked>
答案 1 :(得分:0)
要使默认情况下的复选框处于选中状态,只需将其赋予选中属性
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox
<input value="Anne Stokes" data-path="Anne Stokes" type="checkbox" checked>
示例代码段:
<fieldset>
<legend>Choose your interests</legend>
<div>
<input type="checkbox" id="coding" name="interest" value="coding" checked>
<label for="coding">Coding</label>
</div>
<div>
<input type="checkbox" id="music" name="interest" value="music">
<label for="music">Music</label>
</div>
</fieldset>