I have a few checkboxes on my page. One is rendered statically, while the others are rendered from the model:
<table>
<tr>
<td>
@Html.CheckBoxFor(m => m.AllLangsChecked, new { onchange = "checkedChanged" })
<script>
$('input:checkbox').change(function () {
$('input:checkbox').not(this).prop('checked', false);
})
</script>
<label>Alle Sprachen</label>
</td>
</tr>
@for (int i = 0; i < Model.checkLangs.Count; i++)
{
<tr>
<td>
@Html.HiddenFor(m => m.checkLangs[i].Name)
@Html.HiddenFor(m => m.checkLangs[i].LanguageId)
@Html.CheckBoxFor(m => m.checkLangs[i].isChecked)
<label>@Model.checkLangs[i].Name</label>
</td>
</tr>
}
</table>
Now you can see my tag. Its job is basically to uncheck all of the dynamic checkboxes when the top one is checked.
This does work fine. However, the script also unchecks litereally ALL checkboxes on that page. (there are a few more).
But I only want those from the loop to be disabled.
How would you go on about this?
Thank you!