We have some jquery that disables checkboxes if a certain value of the group is checked. That works great but if you uncheck the disabling checkbox, it isn't re-enabling all of them.
$("input[name$='mp_speccap']").click(function() {
if ($(this).val()=="None of these") {
$(".speccap").prop('disabled', true);
$(".speccap2").prop('disabled', true);
}
else if ($(this).val()=="I don’t know") {
$(".speccap").prop('disabled', true);
$(".speccap1").prop('disabled', true);
}
else {
$(".speccap").prop('disabled', false);
$(".speccap1").prop('disabled', false);
$(".speccap2").prop('disabled', false);
}
});
This is the checkbox set
<input type="checkbox" name="mp_speccap" class="speccap" value="Aviation" <cfif getapp.mp_speccap contains "Aviation">checked</cfif> <cfif getapp.mp_speccap is "None of these" or getapp.mp_speccap is "I don’t know">disabled</cfif>> Aviation<br>
<input type="checkbox" name="mp_speccap" class="speccap" value="Embassy duty" <cfif getapp.mp_speccap contains "Embassy duty">checked</cfif> <cfif getapp.mp_speccap is "None of these" or getapp.mp_speccap is "I don’t know">disabled</cfif>> Embassy duty<br>
<input type="checkbox" name="mp_speccap" class="speccap" value="EOD (Explosive Ordnance Disposal)" <cfif getapp.mp_speccap contains "EOD (Explosive Ordnance Disposal)">checked</cfif> <cfif getapp.mp_speccap is "None of these" or getapp.mp_speccap is "I don’t know">disabled</cfif>> EOD (Explosive Ordnance Disposal)<br>
<input type="checkbox" name="mp_speccap" class="speccap" value="MARSOC (Marine Corps Special Operations Command)" <cfif getapp.mp_speccap contains "MARSOC (Marine Corps Special Operations Command)">checked</cfif> <cfif getapp.mp_speccap is "None of these" or getapp.mp_speccap is "I don’t know">disabled</cfif>> MARSOC (Marine Corps Special Operations Command)<br>
<input type="checkbox" name="mp_speccap" class="speccap" value="RECON (Reconnaissance) or Force RECON" <cfif getapp.mp_speccap contains "RECON (Reconnaissance) or Force RECON">checked</cfif> <cfif getapp.mp_speccap is "None of these" or getapp.mp_speccap is "I don’t know">disabled</cfif>> RECON (Reconnaissance) or Force RECON<br>
<input type="checkbox" name="mp_speccap" class="speccap1" value="None of these" <cfif getapp.mp_speccap contains "None of these">checked</cfif> <cfif getapp.mp_speccap is "I don’t know">disabled</cfif>> None of these<br>
<input type="checkbox" name="mp_speccap" class="speccap2" value="I don’t know" <cfif getapp.mp_speccap contains "I don’t know">checked</cfif> <cfif getapp.mp_speccap is "None of these">disabled</cfif>> I don’t know<br>
https://jsfiddle.net/mplungjan/esLft1ba/
Open in new window