ProgrammingWeb-tech - html/css/jsWordpress

jQuery – test jQuery is running

1. Check for the jQuery or $ object:
  • Open your browser’s developer tools (usually by pressing F12 or Ctrl+Shift+I/Cmd+Option+I).
  • Navigate to the “Console” tab.
  • Type jQuery and press Enter.
  • Type $ and press Enter.
     

If jQuery is loaded, these commands will return the jQuery function or object. If jQuery is not loaded, you will likely receive an “Uncaught ReferenceError: jQuery is not defined” or similar error.

 
2. Check the jQuery version:
  • In the console, type jQuery.fn.jquery and press Enter.
  • Alternatively, type $.fn.jquery and press Enter.
     
 
This will return the version number of the loaded jQuery library (e.g., “3.6.0”). If jQuery is not loaded, you will encounter an error.
3. Use a conditional check:
  • In the console, type if (typeof jQuery != 'undefined') { console.log("jQuery is loaded!"); } else { console.log("jQuery is NOT loaded."); } and press Enter. 
     
 
This snippet will explicitly tell you whether jQuery is present on the page.

Leave a Reply

Your email address will not be published. Required fields are marked *