Uncaught ReferenceError: jQuery is not defined in wordpress custom script

My jquery file is not working in WordPress.The error is here:

My js code:

(function($) {
    $(document).ready(function(){
    $('#read_more').click(function() {
    $('.display_none').show().animate({'transition': '2s'});
   });
  });
})( jQuery );

I have an added custom-script.js file in functions.php like this:

function aristo_css_js(){
  wp_enqueue_script('myjs', get_template_directory_uri().'/assets/js/custom-script.js');
  wp_enqueue_script('myjs');
}
add_action('wp_enqueue_scripts','aristo_css_js');

What is the main problem for this was not working? But if I added custom script code before body tag it's working. ?

I solve my own question by add jquery file before my custom-script

wp_enqueue_script('jquery-main', get_template_directory_uri().'/assets/js/jquery-3.3.1.min.js');
wp_enqueue_script('myjs', get_template_directory_uri().'/assets/js/custom-script.js');

Uncaught ReferenceError: jQuery is not defined, I solve my own question by add jquery file before my custom-script wp_enqueue_script('jquery-main', get_template_directory_uri(). One of the most common JavaScript errors in WordPress is – “jquery is not defined”. It makes things stop or not working on your WordPress site. Here at Templatetoaster WordPress website builder, let’s see the causes of this issue and procedure to fix it in detail. Common Causes of getting “Uncaught ReferenceError: jQuery Is Not Defined” in WordPress

I hope this will fix your issue

(function($) {

// Use $() inside of this function like so 

$(#selector)

})(jQuery);

Uncaught ReferenceError: jQuery is not defined in wordpress , WordPress Reference Error is not defined: Fix jQuery is not defined. Here is why you get the “Uncaught Reference Error: jQuery Is Not Defined” in WordPress Add the following snippet in your wp-config.php file. Don't cut out the Fall back to a local copy of jQuery if the CDN fails <script> window.jQuery� Stack Overflow Public questions and answers; Teams Private questions and answers for your team; Enterprise Private self-hosted questions and answers for your enterprise; Jobs Programming and related technical career opportunities

I had this same issue once.

WordPress ships with its own version of the jQuery library.

Try using jQuery instead of just $ sign.

For example:

var svg = $("#svg-container");

should be replaced with

var svg = jQuery("#svg-container");

How to fix the "jQuery is not defined" error in WordPress, jQuery seems not te be loaded within my custom template. So I pass the jQuery argument when enqueuing the script: // Load scripts in header� The major issue is some time WordPress ‘uncaught referenceerror: jquery is not defined’ or $ is not defined jQuery. Therefore, when does this error appear on the WordPress website? when jQuery is not defined on your WordPress project. they come to appear error. In fact, many WordPress themes predefined add library and files of jQuery.

Try to use this updated javascript code,

jQuery.noConflict();
(function(jQuery) {
    jQuery(document).ready(function(){
    jQuery('#read_more').click(function() {
    jQuery('.display_none').show().animate({'transition': '2s'});
   });
  });
})( jQuery );

Uncaught ReferenceError: jQuery is not defined, WordPress Uncaught ReferenceError: jQuery is not defined is one of the common issue that most of the developers faced. This means jQuery is� JavaScript Uncaught ReferenceError: jQuery is not defined; Uncaught ReferenceError: $ is not defined [duplicate] Ask Question Asked 5 years, 11 months ago

jQuery or $ not defined WordPress Issue, Uncaught ReferenceError: jQuery is not defined at (index):222 I see many of your script tags have a defer="defer" attribute on theme. I still see the same error (jQuery is not defined), and it's probably due to custom added jQuery library Could you try removing it and let Wordpress use the default one? Do you want to fix the “Uncaught ReferenceError: $ is Not Defined”? Then, let’s see how to resolve this issue once and for all. Often, WordPress developers feel the need to add custom functionalities to their WordPress websites; functionalities that rely on JavaScript to work perfectly.

jQuery is not defined - Support, Uncaught ReferenceError: jQuery is not defined, jQuery needs to be the first script you jQuery not define in the wordpress wp-admin, I opened up the devtools� Are you using any plugins/custom code that may adjust the jQuery version or minify .js files? Viewing 1 replies (of 1 total) The topic ‘Uncaught ReferenceError: jQuery is not defined’ is closed to new replies.

jQuery is not defined in Wordpress, but my script is enqueued properly, Do you want to fix the “Uncaught ReferenceError: $ is Not Defined”? Then As an example, I created lately a custom Video slider using the famous Slick jQuery plugin and Custom Field pro. <script type="text/javascript">. I'm trying to store in a variable the content of an ACF field so that later on I can use it in a jQuery function using the plugin &quot;Simple Custom CSS and JS&quot;. I found what I thought was the

Comments
  • Make sure you're loading jQuery into the page.
  • Check the order of your scripts, chances are your own is loaded before jQuery.
  • Thanks I got the problem and it solved.@JackBashford
  • 1. OP is already doing this (IIFE passing jQuery) 2. check the error message OP has posted: jQuery is not defined
  • Then double check the order of your scripts. Make sure the jquery script is before your custom script.
  • I already mentioned it on my question. I found the same error when I change with code.