jQuery jplist checkbox default checked

时间:2018-07-24 10:25:05

标签: javascript jquery jplist

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

2 个答案:

答案 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>