{"id":14975421,"url":"https://github.com/jquery/jquery-dist","last_synced_at":"2025-04-04T06:10:07.702Z","repository":{"id":25396374,"uuid":"28825109","full_name":"jquery/jquery-dist","owner":"jquery","description":"Distribution repo for jQuery Core releases","archived":false,"fork":false,"pushed_at":"2024-07-17T13:55:25.000Z","size":21435,"stargazers_count":99,"open_issues_count":0,"forks_count":88,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-03-28T05:12:57.999Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jquery.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.txt","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-01-05T18:14:53.000Z","updated_at":"2025-03-20T13:28:54.000Z","dependencies_parsed_at":"2024-09-11T11:10:56.640Z","dependency_job_id":"6eafca7f-2dab-4e2a-925f-b6431ad7ecc6","html_url":"https://github.com/jquery/jquery-dist","commit_stats":{"total_commits":35,"total_committers":4,"mean_commits":8.75,"dds":"0.48571428571428577","last_synced_commit":"91ef2d8836342875f2519b5815197ea0f23613cf"},"previous_names":[],"tags_count":162,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquery%2Fjquery-dist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquery%2Fjquery-dist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquery%2Fjquery-dist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquery%2Fjquery-dist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jquery","download_url":"https://codeload.github.com/jquery/jquery-dist/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247128753,"owners_count":20888235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T13:52:00.599Z","updated_at":"2025-04-04T06:10:07.685Z","avatar_url":"https://github.com/jquery.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jQuery\n\n\u003e jQuery is a fast, small, and feature-rich JavaScript library.\n\nFor information on how to get started and how to use jQuery, please see [jQuery's documentation](https://api.jquery.com/).\nFor source files and issues, please visit the [jQuery repo](https://github.com/jquery/jquery).\n\nIf upgrading, please see the [blog post for 4.0.0-beta.2](https://blog.jquery.com/2024/07/11/second-beta-of-jquery-4-0-0/). This includes notable differences from the previous version and a more readable changelog.\n\n## Including jQuery\n\nBelow are some of the most common ways to include jQuery.\n\n### Browser\n\n#### Script tag\n\n```html\n\u003cscript src=\"https://code.jquery.com/jquery-4.0.0-beta.2.min.js\"\u003e\u003c/script\u003e\n```\n\nor, to use the jQuery ECMAScript module:\n\n```html\n\u003cscript type=\"module\"\u003e\n\timport { $ } from \"https://code.jquery.com/jquery-4.0.0-beta.2.module.min.js\";\n\u003c/script\u003e\n```\n\nor:\n\n```html\n\u003cscript type=\"module\"\u003e\n\timport { jQuery } from \"https://code.jquery.com/jquery-4.0.0-beta.2.module.min.js\";\n\u003c/script\u003e\n```\n\nAll jQuery modules export named `$` \u0026 `jQuery` tokens; the further examples will just show `$`. The default import also works:\n\n```html\n\u003cscript type=\"module\"\u003e\n\timport $ from \"https://code.jquery.com/jquery-4.0.0-beta.2.module.min.js\";\n\u003c/script\u003e\n```\n\nHowever, named imports provide better interoperability across tooling and are therefore recommended.\n\nSometimes 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` \u0026 `queue` modules, we’ve released a “slim” version that excludes these modules. You can load it as a regular script:\n\n```html\n\u003cscript src=\"https://code.jquery.com/jquery-4.0.0-beta.2.slim.min.js\"\u003e\u003c/script\u003e\n```\n\nor as a module:\n\n```html\n\u003cscript type=\"module\"\u003e\n\timport { $ } from \"https://code.jquery.com/jquery-4.0.0-beta.2.module.slim.min.js\";\n\u003c/script\u003e\n```\n\n#### Import maps\n\nTo 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 `\u003cscript type=\"module\"\u003e`:\n\n```html\n\u003cscript type=\"importmap\"\u003e\n\t{\n\t\t\"imports\": {\n\t\t\t\"jquery\": \"https://code.jquery.com/jquery-4.0.0-beta.2.module.min.js\",\n\t\t\t\"jquery/slim\": \"https://code.jquery.com/jquery-4.0.0-beta.2.module.slim.min.js\"\n\t\t}\n\t}\n\u003c/script\u003e\n```\n\nNow, the following will work to get the full version:\n\n```html\n\u003cscript type=\"module\"\u003e\n\timport { $ } from \"jquery\";\n\t// Use $ here\n\u003c/script\u003e\n```\n\nand the following to get the slim one:\n\n```html\n\u003cscript type=\"module\"\u003e\n\timport { $ } from \"jquery/slim\";\n\t// Use $ here\n\u003c/script\u003e\n```\n\nThe advantage of these specific mappings is they match the ones embedded in the jQuery npm package, providing better interoperability between the environments.\n\nYou can also use jQuery from npm even in the browser setup. Read along for more details.\n\n### Using jQuery from npm\n\nThere are several ways to use jQuery from npm. One is to use a build tool like [Webpack](https://webpack.js.org/), [Browserify](https://browserify.org/) or [Babel](https://babeljs.io/). For more information on using these tools, please refer to the corresponding project's documentation.\n\nAnother way is to use jQuery directly in Node.js. See the [Node.js pre-requisites](#nodejs-pre-requisites) section for more details on the Node.js-specific part of this.\n\nTo install the jQuery npm package, invoke:\n\n```sh\nnpm install jquery\n```\n\nIn the script, including jQuery will usually look like this:\n\n```js\nimport { $ } from \"jquery\";\n```\n\nIf you need to use jQuery in a file that's not an ECMAScript module, you can use the CommonJS syntax:\n\n```js\nconst $ = require( \"jquery\" );\n```\n\nThe CommonJS module _does not_ expose named `$` \u0026 `jQuery` exports.\n\n#### Individual modules\n\njQuery is authored in ECMAScript modules; it's also possible to use them directly. They are contained in the `src/` folder; inspect the package contents to see what's there. Full file names are required, including the `.js` extension.\n\nBe aware that this is an advanced \u0026 low-level interface, and we don't consider it stable, even between minor or patch releases - this is especially the case for modules in subdirectories or `src/`. If you rely on it, verify your setup before updating jQuery.\n\nAll top-level modules, i.e. files directly in the `src/` directory export jQuery. Importing multiple modules will all attach to the same jQuery instance.\n\nRemember that some modules have other dependencies (e.g. the `event` module depends on the `selector` one) so in some cases you may get more than you expect.\n\nExample usage:\n\n```js\nimport { $ } from \"jquery/src/css.js\"; // adds the `.css()` method\nimport \"jquery/src/event.js\"; // adds the `.on()` method; pulls \"selector\" as a dependency\n$( \".toggle\" ).on( \"click\", function() {\n\t$( this ).css( \"color\", \"red\" );\n} );\n```\n\n### AMD (Asynchronous Module Definition)\n\nAMD is a module format built for the browser. For more information, we recommend [require.js' documentation](https://requirejs.org/docs/whyamd.html).\n\n```js\ndefine( [ \"jquery\" ], function( $ ) {\n\n} );\n```\n\nNode.js doesn't understand AMD natively so this method is mostly used in a browser setup.\n\n### Node.js pre-requisites\n\nFor 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](https://github.com/jsdom/jsdom). This can be useful for testing purposes.\n\nFor Node-based environments that don't have a global `window`, jQuery exposes a dedicated `jquery/factory` entry point.\n\nTo `import` jQuery using this factory, use the following:\n\n```js\nimport { JSDOM } from \"jsdom\";\nconst { window } = new JSDOM( \"\" );\nimport { jQueryFactory } from \"jquery/factory\";\nconst $ = jQueryFactory( window );\n```\n\nor, if you use `require`:\n\n```js\nconst { JSDOM } = require( \"jsdom\" );\nconst { window } = new JSDOM( \"\" );\nconst { jQueryFactory } = require( \"jquery/factory\" );\nconst $ = jQueryFactory( window );\n```\n\n#### Slim build in Node.js\n\nTo 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`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjquery%2Fjquery-dist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjquery%2Fjquery-dist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjquery%2Fjquery-dist/lists"}