Whether you’re working on a new project or debugging an existing one, it’s essential to know the version of jQuery that you are using. One of the easiest ways to find the jQuery version is by using your browser’s console. In this blog post, we will guide you through the steps to check the jQuery version from the console.
Step 1: Open the Console
First, you’ll need to open your browser’s console. This can be done using the following keyboard shortcuts:
- Google Chrome: Ctrl + Shift + J (Windows) or Cmd + Option + J (Mac)
- Firefox: Ctrl + Shift + K (Windows) or Cmd + Option + K (Mac)
- Safari: Cmd + Option + C (Mac)
- Microsoft Edge: F12 (Windows)
Step 2: Check the jQuery Version
Once you have the console open, simply type the following command and press Enter:
jQuery.fn.jquery
This command will return the version number of the currently loaded jQuery library on the webpage. If jQuery is not loaded or has an issue, the console will throw an error.
Alternative Method: Check the jQuery Version with Dollar Sign Alias
As an alternative, you can use the dollar sign ($) alias to check the jQuery version. Type the following command in the console and press Enter:
$.fn.jquery
This command will also return the version number of the currently loaded jQuery library.
Example
Let’s see an example of how to know jQuery version from console. If your website is using jQuery version 3.6.0, running the commands mentioned above in the console will give you the following output:
> jQuery.fn.jquery "3.6.0" > $.fn.jquery "3.6.0"
Conclusion
Knowing the jQuery version is crucial when working with various plugins and libraries that depend on a specific version. By using the console commands mentioned in this post, you can quickly and easily find the jQuery version that is currently in use on a webpage. Happy coding!