From 7c0e43012f2d1deb0e0c316f94e68457bab732f9 Mon Sep 17 00:00:00 2001 From: saifsultanc Date: Mon, 27 Jan 2025 22:11:28 +0530 Subject: [PATCH] `gw-limit-columns-in-survey-field-to-single-selection.js`: Fixed issue with snippet not working with GF2.5 theme. --- ...it-columns-in-survey-field-to-single-selection.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gravity-forms/gw-limit-columns-in-survey-field-to-single-selection.js b/gravity-forms/gw-limit-columns-in-survey-field-to-single-selection.js index e9364c26a..02535af3b 100644 --- a/gravity-forms/gw-limit-columns-in-survey-field-to-single-selection.js +++ b/gravity-forms/gw-limit-columns-in-survey-field-to-single-selection.js @@ -33,6 +33,16 @@ $( document ).on( 'change', `#field_${GFFORMID}_${fieldId} input[type="radio"]`, const $radiosInColumn = $table.find( `input[type="radio"][aria-labelledby*="${columnId}"]` ); // Deselect all other radio buttons in the same column. - $radiosInColumn.not( $selectedRadio ).prop( 'checked', false ); + $radiosInColumn.not($selectedRadio).each(function () { + let $radio = $(this); + let $parentTd = $radio.closest('td'); + + $radio.prop('checked', false); + + // if gsurvey-likert-selected class is added to the parent td, remove it (GF 2.5 Theme). + if ( $parentTd.length && $parentTd.hasClass( 'gsurvey-likert-selected' ) ) { + $parentTd.removeClass( 'gsurvey-likert-selected' ); + } + }); } });