Is there a way to have a “none of the above” checkbox that would uncheck all other options? I tried using the solution posted here:
Is there a way to achieve this below:
When “none of the above” is checked: all the other options become unchecked and disabled.
When “none of the above” is unchecked: all the other options become enabled again.
[checkbox]
See example below:
Thank you in advance.
but I’m getting a syntax error.
I pasted the following snippet:
$(‘.gfield-choice-input[value=“none”]’).on(‘change’, function() {
if ( $(this).is(‘:checked’) ) {
$(this).parent().siblings().find(‘.gfield-choice-input’).each( function() {
this.checked = false;
});
}
});
$(‘.gfield-choice-input:not([value=“none”])’).on(‘change’, function() {
if ( $(this).is(‘:checked’) ) {
$(this).parent().siblings().find(‘.gfield-choice-input[value=“none”]’).prop(‘checked’,false);
}
});
I get this error:
syntax error, unexpected ‘(’, expecting variable (T_VARIABLE) or ‘{’ or ‘$’
chrishajer
(Chris (Gravity Forms))
April 14, 2023, 2:28am
2
That’s a jQuery snippet, but your error message sounds like a PHP error. Did you add this to an HTML field in the form, or via PHP? Can you explain how you added it?
I added it to the functions.php section
I also just tried to add it to an html field, but that doesn’t work
system
(system)
Closed
May 14, 2023, 5:53pm
5
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.