Guide · Open source
How to use jQuery: install, build and customise it
Updated · written with AI from the project's own documentation and checked against our catalogue data
jQuery is a JavaScript library for working with web pages. It gives you shorter, consistent ways to select page elements, change them, respond to user events and make AJAX requests. This guide shows you how to get jQuery from its repository, build it, find the output files and create a custom build with only the modules you need.
Quick start
- 1Check prerequisites. Install the latest Node.js with npm and git 1.7 or later. On macOS, use Homebrew; on Windows, use the official download pages.
- 2Clone the repository. Run git clone on the jQuery repository URL to get the source code onto your machine.
- 3Install dependencies and build. Change into the jquery folder, run npm install, then run npm run build.
- 4Find the built file. Look in the dist/ directory for jquery.js, a minified copy and the map file.
- 5Build all release variants (optional). Run npm run build:all to create the slim and module variants, placed in dist/ and dist-module/.
- 6Choose modules for a custom build (optional). Decide which modules you need, then pass excluded module paths to --exclude or use --include. Core cannot be excluded.
- 7Check the build options. Run npm run build -- --help to see the full list of options before creating a custom build.
What jQuery does and where it runs
jQuery focuses on the everyday tasks of web page scripting: selecting elements, changing them, handling user events and sending AJAX requests. The project describes it as a library, not a full application framework.
The README says jQuery can be used in browsers and also in Node and other non-browser environments. Browser support details are on the project's browser support page.
- Select and change page elements
- Respond to user events with methods such as .on() and .off()
- Make AJAX requests with $.ajax(), $.get() and $.post()
Check which jQuery branch fits your project
jQuery's README lists support levels by branch. The main branch has full support. The 3.x branch receives only critical updates. The 2.x and 1.x branches are no longer supported.
The README recommends that all users upgrade to the latest version for performance, security and features. For older branches, commercial support is offered by HeroDevs and TuxCare. The project's version support page has more detail.
- Main branch: full support
- Older 3.x branch: critical updates only
- 2.x and 1.x branches: no support
Install the prerequisites for building jQuery
To build jQuery you need the latest Node.js with npm and git 1.7 or later. The README says earlier versions might work but are not supported.
On Windows, download and install git and Node.js from their official sites. On macOS, install Homebrew first, then run the brew commands below. On Linux or BSD, use your package manager to install git and Node.js, or build from source.
- Windows: install git and Node.js from their official download pages
- macOS: install Homebrew, then install git and Node.js with Homebrew
- Linux and BSD: use your distribution's package manager
brew install git
brew install nodeClone and build jQuery
First, clone the jQuery git repository. Then enter the jquery directory, install the dependencies and run the build script.
The built version of jQuery is placed in the dist/ directory, along with a minified copy and its map file.
git clone https://github.com/jquery/jquery.git
cd jquery
npm install
npm run buildBuild all jQuery release files
To create every variant that jQuery includes in a release, run the build:all script. This creates jquery.js, jquery.slim.js, jquery.module.js and jquery.slim.module.js, each with its minified file and sourcemap.
The two module files are ECMAScript modules that export jQuery and $ as named exports. They are placed in the dist-module/ directory rather than dist/.
- jquery.js and jquery.slim.js go to dist/
- jquery.module.js and jquery.slim.module.js go to dist-module/
npm run build:allMake a custom, smaller jQuery build
The build script can create a version that includes only the modules you need. Any module can be excluded except core. You pass a module's path relative to the src folder, without the .js extension, to the --exclude option. The --include option drops the default includes and builds only the modules you list.
Excluding the selector module does not remove it. It is replaced with a small wrapper around the browser's native querySelectorAll, which does not support jQuery's selector extensions. To see every build option, run the help command.
You can also set the AMD module name with --amd, change the output name with --filename and change the output directory with --dir, which is relative to the project root. The --esm option creates an ECMAScript module, and the --factory option creates a build for environments without a global window.
- ajax: all AJAX functions, including $.ajax(), $.get(), $.post() and .load()
- ajax/xhr: the XMLHttpRequest transport only
- ajax/script: the script transport, used to retrieve scripts
- effects: .animate() and shorthands such as .slideUp()
- event: .on() and .off() and all event functionality
- dimensions: .width() and .height()
- offset: .offset(), .position(), .scrollLeft() and .scrollTop()
- wrap: .wrap(), .wrapAll(), .wrapInner() and .unwrap()
- deprecated: methods marked deprecated but not yet removed
- exports/global: stops $ and jQuery being attached to window
npm run build -- --helpWhat people use it for
- Maintaining an existing website that already depends on jQuery
- Keeping a plugin working for projects that rely on jQuery
- Creating a smaller custom build that includes only the modules you use
- Learning how DOM manipulation and events work in older web code
- Producing an ECMAScript module build for a module-based project
Frequently asked questions
Is jQuery free to use?
Yes. The repository is listed under the MIT licence. Check the LICENSE file in the repository for the full terms before you use it in your project.
What do I need to install jQuery?
The README says you need the latest Node.js with npm and git 1.7 or later to build it. The project does not describe a separate installer, so the route it documents is clone and build.
Is jQuery still supported?
The main branch has full support. The older 3.x branch gets critical updates only, and the 2.x and 1.x branches are no longer supported. The README recommends upgrading to the latest version.
Should I use jQuery for a new project?
The README does not position jQuery as a full application framework. For new projects that need modern framework features, the README's comparison list includes React and Vue, along with smaller libraries such as Zepto and Cash.
Why does my build fail or not work?
The README says earlier versions of Node.js or git might work but are not supported. Make sure you have the latest Node.js and git 1.7 or later, then run npm run build -- --help to check the available options.
Where is the built jQuery file?
The built file is placed in the dist/ directory, with a minified copy and an associated map file. The ECMAScript module variants go to dist-module/ instead.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
jQuery suits developers who maintain existing sites or plugins that already depend on it, and students learning older DOM and event code. Teams starting a new application that needs modern framework features should look at options such as React or Vue instead, since the README does not present jQuery as a full framework.
Install options & downloads