I have a little question.
I want to know how to prevent a checkbox from being checked when there is another checkbox marked with a similar characteristic.
For example: I have the following code:
<td>
<label for="check1"> Valor1
<input id="check1" type="checkbox" serial="1324" />
</label>
<label for="check2"> Valor2
<input id="check2" type="checkbox" serial="1324" />
</label>
</td>
What I want to do is that if, for example, I have #check1 marked, it shows me an alert when trying to dial #check2 since it has the same serial number as #check1
The way I'm doing it now is with the following code:
$(this).closest("td").find(":checkbox:not(:checked)").prop("disabled", $(this).is(":checked"));
What it does is that it disables the following checkbox inside it but it does not work optimally for me since there may be other inputs inside it
I hope you can help me, thank you very much in advance
Try the following:
If you want to show an alert if there is already one marked with the same serial, you can try the following: