• Resolved Matt Scheidler

    (@matt6303)


    I am just getting started with a new website using Astra and a custom child theme.

    When trying to add a jQuery script to the site, I get the following error in my Chrome browser console::

    VM4081:1 Uncaught ReferenceError: jQuery is not defined
    at <anonymous>:1:1

    When I switch back to the TwentySixteen theme the code runs as expected. But when I switch to Astra, or my Astra child, I get the above error. What might be causing this?

    I’ve disabled plugins, etc. and it makes no difference – jQuery works on the default theme but doesn’t with Astra.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @matt6303,

    If you are adding custom JS based on jQuery, you will have to include jQuery from your child theme.

    wp_enqueue_script( 'jquery' );

    adding this line in your script enqueue function will load jQuery.

    Thread Starter Matt Scheidler

    (@matt6303)

    Nikhil,

    Thank you! I actually discovered this myself at about the same time that you were posting a reply. Not used to a parent theme not including jQuery and I figured there must have been a bigger issue. I’ve done as you suggested and all is well. I really appreciate the quick reply!

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