0
votes

Si la case à cocher vérifiée modifiée, changez la classe sur TD

Je veux seulement TD (test 1) de changement de classe (jaune). Comment faire uniquement TD (test 1) Changer de couleur (pas une ligne entière).

p>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table class="table">
  <thead>
    <tr>
      <th nowrap>TGL</th>
      <th>CEK</th>
      <th>TITEL</th>
      <th>VAL</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>01.12.19</td>
      <td nowrap><input type='checkbox' name='cek' /></td>
      <td nowrap>Test 1</td>
      <td nowrap>1</td>
    </tr>
  </tbody>
</table>


1 commentaires

Essayez le plus proche ('td') au lieu de le plus proche ('tr')


3 Réponses :


1
votes

Vous pouvez essayer le code ci-dessous.

p>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table class="table" >
<thead>
<tr>
<th nowrap>TGL</th>
<th>CEK</th>	
<th>TITEL</th>
<th>VAL</th>
</tr>
</thead>
<tbody>
<tr>
<td>01.12.19</td>
<td nowrap><input type='checkbox' name='cek' /></td>
<td nowrap>Test 1</td>
<td nowrap>1</td>
</tr>
</tbody>
</table>


0 commentaires

1
votes

Utiliser parent () code> avec suivant () code>.

p>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table class="table">
  <thead>
    <tr>
      <th nowrap>TGL</th>
      <th>CEK</th>
      <th>TITEL</th>
      <th>VAL</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>01.12.19</td>
      <td nowrap><input type='checkbox' name='cek' /></td>
      <td nowrap>Test 1</td>
      <td nowrap>1</td>
    </tr>
  </tbody>
</table>


0 commentaires

1
votes

Vous pouvez faire quelque chose ci-dessous strong>

p>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table class="table" >
<thead>
<tr>
<th nowrap>TGL</th>
<th>CEK</th>	
<th>TITEL</th>
<th>VAL</th>
</tr>
</thead>
<tbody>
<tr>
<td>01.12.19</td>
<td nowrap><input type='checkbox' name='cek' /></td>
<td nowrap>Test 1</td>
<td nowrap>1</td>
</tr>
</tbody>
</table>


0 commentaires