jquery
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
jQuery is a powerful, lightweight, and feature-rich JavaScript library, designed to simplify the client-side scripting of HTML. This open-source library is built to condense tasks that require mere lines of JavaScript into methods that we can call using a single line of code. It simplifies many tasks in web development like HTML document traversal and manipulation, event handling, and animation.
To use jQuery, first, you must include it in your project. This inclusion can be done through different methods. For the browser, you can use a script tag directly in your HTML like this:
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
If you use module bundlers like Webpack, Browserify, or Babel, you can include jQuery using the ES6 import syntax in your JavaScript file:
import $ from "jquery";
Alternatively, if your file is not an ECMAScript module, you can use the CommonJS syntax to include jQuery:
var $ = require( "jquery" );
For usage in Node.js, you first need to install jQuery through npm using the command npm install jquery
. After installation, you can require jQuery with a window object using jsdom.
const { JSDOM } = require( "jsdom" );
const { window } = new JSDOM( "" );
const $ = require( "jquery" )( window );
Remember that jQuery code is usually wrapped within a document ready event, to ensure the code doesn't run until the document is finished loading:
$(document).ready(function() {
// your code here
});
For a more detailed introduction and guidelines on using jQuery, the official jQuery documentation is an excellent resource. It provides comprehensive material on getting started with jQuery, its functionalities, and various commands. For source files and bug tracking, please head over to the jQuery GitHub repository.