I have a table with multiple columns, 2 of them being checkboxes. However, I only want the first column of checkboxes to be enabled on page load. I only want the second column of checkboxes to be enabled if a checkbox is checked in the first column.
My current code will do that but I am wanting the checked checkbox to only enable/disable the specific checkbox in that same row, not all of them in the entire column.
How can I do this? This is what I have so far:
Javascript:
$(document).ready(function () {
$('.paid').attr('disabled', true);
$('.selected').change(function(){
$('.paid').attr('disabled', !this.checked);
});
});
HTML:
//checkbox that is enabled on page load
<td align="center"><input type="checkbox" id="check" class="selected" name="selected"></td>
//checkbox that will be enabled/disabled based on checkbox above
<td align="center"><input type="checkbox" id="paid" class="paid" name="selected"></td>
Aucun commentaire:
Enregistrer un commentaire