Please help i want to enable select with checkbox if the checkbox is checked within the row. the code only works within the first row but the rest is not working. the id of my checkbox is roomCheck and name is chkbox
<table name = "mytab1" id = "MyTable" border = "1">
<tr>
<td><input type = "checkbox" name = "chkbox" id = "roomCheck"></td>
<td><select id = "number" disabled><option>test</option></select>
</tr>
<tr>
<td><input type = "checkbox" name = "chkbox"></td>
<td><select id = "number" disabled><option>test</option></select>
</tr>
<tr>
<td><input type = "checkbox" name = "chkbox" id = "roomCheck"></td>
<td><select id = "number" disabled><option>test</option></select>
</tr>
<tr>
<td><input type = "checkbox" name = "chkbox" id = "roomCheck"></td>
<td><select id = "number" disabled><option>test</option></select>
</tr>
<tr>
<td><input type = "checkbox" name = "chkbox" id = "roomCheck"></td>
<td><select id = "number" disabled><option>test</option></select>
</tr>
<tr>
<td><input type = "checkbox" name = "chkbox" id = "roomCheck"></td>
<td><select id = "number" disabled><option>test</option></select>
</tr>
</table>
<script src="jquery.min.js"></script>
<script language="JavaScript">
var update = function () {
if ($("#roomCheck").is(":checked")) {
$('#number').prop('disabled', false);
}
else {
$('#number').prop('disabled', 'disabled');
}
};
$(update);
$("#roomCheck").change(update);
</script>
</script>
Aucun commentaire:
Enregistrer un commentaire