Last active
November 23, 2021 06:20
-
-
Save sonichandni/cece3f628cbba9b3893aa10039871435 to your computer and use it in GitHub Desktop.
Unselect other multiple choices when the user selects none or anything related to none like none of above or none option
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on('click', '.checkboxClass', function () { | |
if($(this).val().includes("none")) { | |
cr_val = $(this).val(); | |
ch_nm = $(this).attr('name'); | |
$("input[name='"+ch_nm+"'][value!='"+cr_val+"']").prop("checked",false); | |
} else { | |
ch_nm = $(this).attr('name'); | |
$("input[name='"+ch_nm+"']").each( function() { | |
console.log($(this).val()); | |
if($(this).val().includes("none")) { | |
$(this).prop("checked", false) | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment