I want to check box K and F is selected if Check box D is checked and other checkbox to be unchecked, Similarly, if the check box I is selected the preceding chekbox of I to be selected and the following to be unchecked. My html code is:
<td><input type="checkbox" class= "knitting" name="knitting[]" value="1">K</td>
<td><input type="checkbox" class= "fmending" name="fmending[]" value="1">F</td>
<td><input type="checkbox" class= "dyeing" name="dyeing[]" value="1">D</td>
<td><input type="checkbox" class = "firon" name="firon[]" value="1">Y</td>
<td><input type="checkbox" class= "linking" name="linking[]" value="1">L</td>
<td><input type="checkbox" class="smending" name="smending[]" value="1">S</td>
<td><input type="checkbox" class="siron" name="siron[]" value="1">I</td>
<td><input type="checkbox" class="packing" name="packing[]" value="1">P</td>
<td><input type="checkbox" class="data" name="data[]" value="1">D</td>
<td><input type="checkbox" class="chalan" name="chalan[]" value="1">C</td>
And what i have done for that is :
$(".dyeing").click(function () {
$(".knitting").prop("checked", true);
$(".fmending").prop("checked", true);
$(".firon").prop("checked", false);
$(".linking").prop("checked", false);
$(".smending").prop("checked", false);
$(".siron").prop("checked", false);
$(".packing").prop("checked", false);
$(".data").prop("checked", false);
$(".chalan").prop("checked", false);
});
This looks messy, is there another cool process???
Aucun commentaire:
Enregistrer un commentaire