In JavaScript jQuery is a JavaScript script package meant to make common and repetitive tasks in JavaScript with HTML short and understandable code. The first stable release of jQuery was released by John Resig on January 26, 2006, with several additional releases since then.
To use jQuery, you can download and place the single jQuery file locally on a personal server, or use a public CDN from companies such as Google or Microsoft. To load jQuery place the below script line in your HTML code, similar to the example below, which is loading jQuery from a Google CDN. Using a public CDN is likely to increase page load speed, because the visitor may already have downloaded and cached the script file.
Once the JavaScript is loaded, using the $ function, similar to the example below.
In the example above, the JavaScript is loading the toggle jQuery function to show and hide the below div. The 800 in the toggle gives an animation to the div as it is hidden or shown.
Finally, the above HTML code creates a Toggle Button and the div that hides and shows depending on the state of the toggle.
Live example
Toggle Button
AJAX, JavaScript, lowerCamelCase, Web design terms
Related information
- The official jQuery website.