How to crack jQuery error-JQuery is not defined?


How often we come across an error like "jQuery is not defind" in Drupal 8? Quite a lot of time. In most cases, this error can be resolved by passing drupal setting argument in drupal js behaviour. In your theme.libraries.yml file of your theme that you have used add these line in your global scripting tag 

Step 1

    - core/jquery
    - core/drupal
    - core/drupalSettings 

Once you are done with step 1 then clear chache. Open your Drupal JS behaviour (where you have written your JS code)file and define these arguments in your drupal js behaviour file 

for example 

 (function($, Drupal, drupalSettings) {

  Drupal.behaviors.behaviorname = 

           ---  code ----


 })(jQuery , Drupal, drupalSettings);


 Hope! this works well for resolving JQuery error.