Skip to content

Commit 05a5f1d

Browse files
authored
gw-choice-counter.php: Fixed an issue where the Choice Counter snippet did not work correctly in some Divi-based setups due to jQuery conflicts.
1 parent dcfe47f commit 05a5f1d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

gravity-forms/gw-choice-counter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function output_script() {
7272

7373
var choiceFieldId = self.choiceFieldIds[i],
7474
choiceFieldSelector = '#input_' + self.formId + '_' + choiceFieldId,
75-
$choiceField = $(choiceFieldSelector),
75+
$choiceField = jQuery(choiceFieldSelector),
7676
$parentForm = $choiceField.parents('form');
7777

7878
$parentForm.off( 'click', choiceFieldSelector, self.updateChoiceEventHander );
@@ -101,7 +101,7 @@ function output_script() {
101101
self.updateChoiceEventHandler();
102102

103103
// Listen for `gppa_updated_batch_fields` and update count as GPPA may have re-written choice fields
104-
$( document ).on( 'gppa_updated_batch_fields', function( e, formId ) {
104+
jQuery( document ).on( 'gppa_updated_batch_fields', function( e, formId ) {
105105
if ( parseInt( formId ) === self.formId ) {
106106
self.updateEventHandlers();
107107
self.updateChoiceEventHandler();
@@ -115,14 +115,14 @@ function output_script() {
115115

116116
self.updateChoiceCount = function( formId, choiceFieldIds, countFieldId, values ) {
117117

118-
var countField = $( '#input_' + formId + '_' + countFieldId ),
118+
var countField = jQuery( '#input_' + formId + '_' + countFieldId ),
119119
count = 0;
120120

121121
// Prevent count field from being recalculated if it's hidden.
122122
if ( ! gformIsHidden( countField ) ) {
123123
for ( var i = 0; i < choiceFieldIds.length; i++ ) {
124124

125-
var $choiceField = $( '#input_' + formId + '_' + choiceFieldIds[ i ] );
125+
var $choiceField = jQuery( '#input_' + formId + '_' + choiceFieldIds[ i ] );
126126
if ( ! values ) {
127127
// If no values provided in the config, just get the number of checkboxes checked.
128128
if ( self.isCheckableField( $choiceField ) ) {

0 commit comments

Comments
 (0)