jQuery Basic HTML Structure

Start a jQuery page by writing normal HTML, loading the jQuery library, and then placing your jQuery code after the library has loaded. The templates below are ready to copy and adapt.

For this tutorial collection: use the full jQuery build when you need AJAX or jQuery effects. The slim build intentionally leaves those modules out.

jQuery Starter Template Top ↑

This template loads the minified jQuery 4.0.0 production file from the official jQuery CDN and uses the short DOM-ready form.

Why the script order matters

The jQuery library must load before code that calls $(). If your own script runs first, the browser does not yet know what $ refers to.

jQuery UI Starter Template Top ↑

jQuery UI builds on jQuery, so load jQuery first, then the jQuery UI JavaScript. The UI stylesheet belongs in the document head.

CDN or Local Copy? Top ↑

A CDN is convenient for learning and quick examples. A local copy gives you direct control over the file version and availability. In either case, keep the version explicit so an unexpected upgrade does not change your page without review.

DOM Ready Syntax Top ↑

These two forms are equivalent. The shorter version is convenient for most examples:

$(function () {
    // jQuery code
});
$(document).ready(function () {
    // jQuery code
});

← jQuery tutorial home · Next: functions used with jQuery →






plus2net.com






✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer