I have the following JS:
function init_selectAllFull(){
$('#select-all-perms input, #user_full_access_to_all_shows').click(function() {
var checked = $(this).is(':checked');
$('#show-permissions-list').find('input[type=checkbox].full_access').each(function() {
if (checked) {
$(this).prop("checked", true);
} else {
$(this).removeAttr("checked");
$(".internal.external[value='none']").prop('checked', true);
$(".external[value='none']").prop('checked', true);
$(".internal[value='none']").prop('checked', true);
$(".external.internal[value='none']").prop('checked', true);
}
$(this).trigger("change");
});
});
}
It checks a bunch of radio fields when user unchecks a field. This works but I don't like the following code, there's too much repetition going on.
$(".internal.external[value='none']").prop('checked', true);
$(".external[value='none']").prop('checked', true);
$(".internal[value='none']").prop('checked', true);
$(".external.internal[value='none']").prop('checked', true);
Is there a cleaner way to target multiple classes? any help would be greatly appreciated. thank you so much!
$(".internal.external[value='none']")and$(".external.internal[value='none']")(See Fiddle)