• Howdy!
    I have troubles with jQuery. With the plugin Scripts’n’Styles I can add individual code to every page and post. That’s what I did for the start page. Therefor I used jQuery code. When I preview the size within the Customizr everything looks good. When I look at the homepage, the console gives me the error that $ is not a function. jQuery couldn’t be loaded.
    I already tried to update jQuery, but then it looks good on the homepage but fails in the Customizr (only showing the spinning wheel).

    Can somebody give me a hint?

    Cheers,
    mietzi

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • You should ask at the plugin’s support forum if the plugin is loading jQuery for you.
    But plugins and themes are supposed to load the version of jQuery bundled in WordPress. This version is loaded in no-conflict mode which means that $ is not defined. (jQuery is)

    It’s likely that where you were seeing it work, some other code was loading jQuery. And that code was not running where it wasn’t working.

    Moderator bcworkz

    (@bcworkz)

    The WP jQuery is being loaded on the page you linked. The $ not defined is because WP jQuery runs in noConflict mode as Joy mentioned. Your need to either change all $ to jQuery in your code or wrap it all in a noConflict wrapper. See https://developer.wordpress.org/reference/functions/wp_enqueue_script/#div-comment-1831

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘jQuery doesn’t load’ is closed to new replies.