• Resolved btaens

    (@btaens)


    We were having an issue with the plugin’s javascript components not working, for example, when certain fields needed to be hidden or shown based on another fields value.

    We figured out the issue was with how the plugin declares the “$” variable. It does not seem to check whether it has been declared before, and in our case another component has already declared it with const, and the entire javascript portion of WC Fields Factory crashed at the first line as a result.

    Instead of simply declaring:
    var $ = jQuery;
    A safety check should be done beforehand:

    if (typeof $ == 'undefined') {
        const $ = jQuery;
    }

    Please, implement the fix so we can keep upgrading the plugin.

    • This topic was modified 4 years, 1 month ago by btaens. Reason: Added code blocks
    • This topic was modified 4 years, 1 month ago by btaens. Reason: changed solution for "strict" mode
    • This topic was modified 4 years, 1 month ago by Steven Stern (sterndata).
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘jQuery declaration issue’ is closed to new replies.