I am developing a form that contains a checkbox list, which belong to the class .causa , likewise there is a checkbox of the class .without_cause which I intend that disables the checkboxes mentioned initially. Searching the Internet I found the following example, which only allows you to disable checkboxes no matter which class you click:
$('input[type=checkbox]').on('change', function() {
if ($(".sin_causa").is(':checked') ) {
$( ".causa" ).prop( "disabled", false );
alert('Unchecked');
} else {
$( ".causa" ).prop( "disabled", true );
alert('Checked');
}
});
<tr>
<th rowspan="1">Propuesta Económica</th>
<td>Los precios de sus productos son elevados</td>
<td><label> </label><input class="form-check-input causa" type="checkbox" value="22" id="causas[]" name="causas[]"></td>
</tr>
<tr>
<th rowspan="2">Personal</th>
<td>El particular autorizado/concesionado no se encuentra en el Establecimiento de Consumo Escolar.</td>
<td><label> </label><input class="form-check-input causa" type="checkbox" value="23" id="causas[]" name="causas[]"></td>
</tr>
<tr>
<td>El personal que labora en el Establecimeinto tiene actitudes negativas y presta sus servicios de mal forma. </td>
<td><label> </label><input class="form-check-input causa" type="checkbox" value="24" id="causas[]" name="causas[]"></td>
</tr>
<label><strong>*En caso de no resultar problemática alguna, de click en la siguiente casilla.</strong> <input class="form-check-input" type="checkbox" value="25" id="sin_causa[]" name="sin_causa[]"></label>
I would greatly appreciate your help, as well as guidance that you could give me ...