jQuery Tutorial for Beginners

Definition
jQuery is a fast, lightweight JavaScript library. It makes DOM selection, events, animations, and AJAX shorter with a simple $() syntax.
These tutorials use jQuery 3.7.1. jQuery still powers many legacy sites, WordPress themes, and dashboards. Learn it to maintain and extend those pages with confidence.
Syntax
Almost every jQuery script follows the same pattern.
$(selector).action();
$(function () {
// runs after the HTML is ready
$("#msg").text("Hello jQuery");
}); | Piece | What it does |
|---|---|
$() / jQuery() | Select elements, create HTML, wrap a node, or wait for the DOM. |
selector | A CSS-style query such as "#id", ".class", or "p". |
.action() | A method like .text(), .on(), .hide(), or .fadeIn(). |
| Chaining | Call several methods on the same set: $("#x").hide().fadeIn(). |
Load the jQuery script before your own code. Prefer $(function () { ... }) so the DOM is ready.
First Script
Include the CDN, then update a paragraph when the DOM is ready.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jQuery CDN setup</title>
</head>
<body>
<h1>jQuery CDN demo</h1>
<p id="status">Loading jQuery...</p>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script>
$(function () {
$("#status").text("jQuery " + $.fn.jquery + " is ready.");
});
</script>
</body>
</html> How It Works
- Load. The CDN script defines
$/jQueryon the page. - Ready.
$(function () { ... })runs after the HTML is parsed. - Update.
$("#status").text(...)selects the paragraph and sets its text.
jQuery Topic Index
Browse every category in this jQuery programming tutorial. Each hub links to simple method guides.
| Topic | What you learn | Open |
|---|---|---|
| Core | jQuery() / $(), document ready, and $.noConflict(). | Open |
| Selectors | Find elements with CSS-style queries. | Open |
| Attributes | Get and set HTML attributes, props, and values. | Open |
| CSS | Classes, styles, dimensions, and position. | Open |
| DOM | Add, remove, wrap, and change page content. | Open |
| Traversing | Move through parents, children, and siblings. | Open |
| Events | Event object properties and helper methods. | Open |
| Event Handler | on, off, one, trigger, and proxy. | Open |
| Mouse Events | Click, hover, mouseenter, and related helpers. | Open |
| Keyboard Events | Keydown, keyup, and keypress patterns. | Open |
| Form Events | Submit, change, focus, and blur. | Open |
| Browser Events | Load, resize, scroll, and error. | Open |
| Effects | Show, hide, fade, slide, and animate. | Open |
| Ajax | Load data without a full page refresh. | Open |
| Callbacks | Manage lists of callback functions. | Open |
| Deferred | Promises, then, done, fail, and when. | Open |
| Utilities | Each, map, extend, trim, and helpers. | Open |
| Properties | length, jquery version, context, and selector. | Open |
Frequently Asked Questions
Next: jQuery Core
Learn $(), document ready, and $.noConflict().
CODETOFUN NEWS
Stay Ahead in Tech
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
11 people found this page helpful
