GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.w3schools.com — jQuery Syntax
❮
❯
jQuery TutorialjQuery HOME jQuery Intro jQuery Get Started jQuery Syntax jQuery Selectors jQuery EventsjQuery EffectsjQuery Hide/Show jQuery Fade jQuery Slide jQuery Animate jQuery stop() jQuery Callback jQuery ChainingjQuery HTMLjQuery Get jQuery Set jQuery Add jQuery Remove jQuery CSS Classes jQuery css() jQuery DimensionsjQuery TraversingjQuery Traversing jQuery Ancestors jQuery Descendants jQuery Siblings jQuery FilteringjQuery AJAXjQuery AJAX Intro jQuery Load jQuery Get/PostjQuery MiscjQuery noConflict() jQuery FiltersjQuery CertjQuery CertificatejQuery ExamplesjQuery Examples jQuery Editor jQuery Quiz jQuery Exercises jQuery Syllabus jQuery Study PlanjQuery ReferencesjQuery Overview jQuery Selectors jQuery Events jQuery Effects jQuery HTML/CSS jQuery Traversing jQuery AJAX jQuery Misc jQuery PropertiesjQuery Syntax
Share
jQuery SyntaxjQuery is tailor-made for selecting HTML elements and performing some action on the element(s). Basic syntax is: $(selector).action()
Examples:
Are you familiar with CSS selectors? Tip: If you don't know CSS, you can read our CSS Tutorial. The Document Ready EventYou will notice that all jQuery methods in our examples, are inside a document ready event, like this:
$(document).ready(function(){
// jQuery methods go here... }); This is to prevent any jQuery code from running before the document is finished loading (is ready). It is good practice to wait for the document to be fully loaded and ready before working with it. This also allows you to have your JavaScript code before the body of your document, in the head section. Here are some examples of actions that can fail if methods are run before the document is fully loaded:
Tip: jQuery has also created an even shorter method for the document ready event:
$(function(){
// jQuery methods go here... }); Use the syntax you prefer. We think that the document ready event is easier to understand when reading the code. Free account Track your progress
XP earned 0
Day streak 0
Spaces 0
League —
New Learn in Adventure Mode W3Schools Adventure AppCoding fundamentals as bite-sized lessons and challenges.
×
Contact SalesIf you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: Report ErrorIf you want to report an error, or if you want to make a suggestion, send us an e-mail: Top TutorialsHTML TutorialCSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial Top ReferencesHTML ReferenceCSS Reference JavaScript Reference SQL Reference Python Reference W3.CSS Reference Bootstrap Reference PHP Reference HTML Colors Java Reference AngularJS Reference jQuery Reference
W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning.
Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy. Copyright 1999-2026 by W3Schools. All Rights Reserved. W3Schools is Powered by W3.CSS. |
| You are visitor 01402894 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |