dimanche 5 mars 2017

jQuery Set Checkbox to be Checked based on 3 conditions data

Is it possible to check checkbox based on data-id and data-tipe and data-group using jQuery on my case below:

<table>
<tr>
  <th>Nama</th>
  <th>Create</th>
  <th>Read</th>
  <th>Update</th>
  <th>Delete</th>
</tr>
<tr>
  <td>coba</td>
  <td><input type="checkbox" data-id="1" data-tipe="create" data-group="a"></td>
  <td><input type="checkbox" data-id="1" data-tipe="read" data-group="a"></td>
  <td><input type="checkbox" data-id="1" data-tipe="update" data-group="a"></td>
  <td><input type="checkbox" data-id="1" data-tipe="delete" data-group="a"></td>
</tr>
<tr>
  <td>coba 2</td>
  <td><input type="checkbox" data-id="2" data-tipe="create" data-group="a"></td>
  <td><input type="checkbox" data-id="2" data-tipe="read" data-group="a"></td>
  <td><input type="checkbox" data-id="2" data-tipe="update" data-group="a"></td>
  <td><input type="checkbox" data-id="2" data-tipe="delete" data-group="a"></td>
</tr>
<tr>
  <td><input type="button" id="btnUpdate" value="Update"/>
</tr>

Means if :

if data-id="1" and data-tipe="create" and data-group="a" then check the checkbox

Aucun commentaire:

Enregistrer un commentaire