Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

What is: jQuery

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

jQuery is an open source JavaScript library which is designed to provide easy client side scripting for HTML (See: JavaScript). It works on all major browsers.

In modern web design, jQuery plays an important role in adding client side scripting to web pages. jQuery is widely used to perform various tasks on the client’s browser saving bandwidth and providing a better user experience.

Some example use cases of jQuery include: sliders, lightbox popups, rotating testimonials, etc.

Using jQuery, developers can perform certain actions right in the browser without reloading a page. Some of these actions include navigating a web page, selecting elements on a page to perform actions on them, call Ajax scripts, and handle events like what happens when a user clicks an element.

WordPress comes bundled with jQuery and some essential jQuery libraries. WordPress theme and plugin developers can easily call jQuery in their own plugins and themes to add their own jQuery scripts.

To call jQuery in WordPress theme or plugin, users need to add their own jQuery scripts and enqueue them in WordPress. While enqueuing their scripts, users can call jQuery core or any jQuery plugin that comes with WordPress as a dependency. WordPress automatically loads it along with the user script.

Here is an example code. This code adds a custom javascript and calls jQuery as its dependency.

<?php
wp_enqueue_script('custom-script', get_stylesheet_directory_uri() . '/js/custom_script.js', array( 'jquery' ));
?>

Additional Reading

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!