I have several detail lines on the screen, each one with two checkboxes (one of them bootstrap-toogle) and I would like it when the first checkbox is activated, the second is enabled and it is set to on, and when the first checkbox is deactivated checkbox, put in disable and in off (always the same line).
Code of the first checkbox:
echo "<td><input type='checkbox' class='checkbox_class' name='baja[]' value='' id='check1' onclick='validar_sino(this);''></td>";
Code of the second checkbox:
echo "<td><input type='checkbox' disabled name='sino' id='sino' data-toggle='toggle' data-size='mini' data-on='Si' data-off='No' data-onstyle='success' data-offstyle='danger'></td>";
Javascript code
<script type="text/javascript">
function validar_sino(elemento) {
var checkbox1 = document.getElementById("check1");
if (checkbox1.checked == true) {
$('#sino').bootstrapToggle('on');
$('#sino').bootstrapToggle('enable');
} else {
$('#sino').bootstrapToggle('off');
$('#sino').bootstrapToggle('disable');
}
}
</script>
Can someone help me?
Greetings.