百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
J

jquery-dist

> 编程语言
开源

用于 jQuery 核心发行的分发回波

99 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

用于 jQuery 核心发行的分发回波

jQuery

jQuery is a fast, small, and feature-rich JavaScript library.

For information on how to get started and how to use jQuery, please see jQuery's documentation. For source files and issues, please visit the jQuery repo.

If upgrading, please see the blog post for 4.0.0. This includes notable differences from the previous version and a more readable changelog.

Including jQuery

Below are some of the most common ways to include jQuery.

Browser

Script tag

xml

or, to use the jQuery ECMAScript module:

xml

or:

xml

All jQuery modules export named $ & jQuery tokens; the further examples will just show $. The default import also works:

xml

However, named imports provide better interoperability across tooling and are therefore recommended.

Sometimes you don’t need AJAX, or you prefer to use one of the many standalone libraries that focus on AJAX requests. And often it is simpler to use a combination of CSS, class manipulation or the Web Animations API. Similarly, many projects opt into relying on native browser promises instead of jQuery Deferreds. Along with the regular version of jQuery that includes the ajax, callbacks, deferred, effects & queue modules, we’ve released a “slim” version that excludes these modules. You can load it as a regular script:

xml

or as a module:

xml

Import maps

To avoid repeating long import paths that change on each jQuery release, you can use import maps - they are now supported in every modern browser. Put the following script tag before any `


Now, the following will work to get the full version:

```html

and the following to get the slim one:

xml

…

bash
sh
npm install jquery

In the script, including jQuery will usually look like this:

javascript
import { $ } from "jquery";

If you need to use jQuery in a file that's not an ECMAScript module, you can use the CommonJS syntax:

javascript
const $ = require( "jquery" );

…

js
import { $ } from "jquery/src/css.js"; // adds the `.css()` method
import "jquery/src/event.js"; // adds the `.on()` method; pulls "selector" as a dependency
$( ".toggle" ).on( "click", function() {
	$( this ).css( "color", "red" );
} );

AMD (Asynchronous Module Definition)

AMD is a module format built for the browser. For more information, we recommend require.js' documentation.

javascript
define( [ "jquery" ], function( $ ) {

} );

Node.js doesn't understand AMD natively so this method is mostly used in a browser setup.

Node.js pre-requisites

For jQuery to work in Node, a window with a document is required. Since no such window exists natively in Node, one can be mocked by tools such as jsdom. This can be useful for testing purposes.

For Node-based environments that don't have a global window, jQuery exposes a dedicated jquery/factory entry point.

To import jQuery using this factory, use the following:

javascript
import { JSDOM } from "jsdom";
const { window } = new JSDOM( "" );
import { jQueryFactory } from "jquery/factory";
const $ = jQueryFactory( window );

or, if you use require:

javascript
const { JSDOM } = require( "jsdom" );
const { window } = new JSDOM( "" );
const { jQueryFactory } = require( "jquery/factory" );
const $ = jQueryFactory( window );

Slim build in Node.js

To use the slim build of jQuery in Node.js, use "jquery/slim" instead of "jquery" in both require or import calls above. To use the slim build in Node.js with factory mode, use jquery/factory-slim instead of jquery/factory.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言