jQuery TutorialLesson 3Free preview
jQuery Get Started
This lesson is part of jQuery · All levels
Summary
Starting jQuery means putting a library file into a page and then writing code once the document is ready. The code should be placed inside the $(document).ready() so that the HTML element is available when selected. Another alternative is to put a script tag at the end of the body so that the DOM is already formed before the script is executed.
Key points
- jQuery is loaded with script tags, both from CDN and local files
- $(document).ready() ensures the code runs after the DOM is completed
- Scripts run before the DOM is ready often fail to find the elements
- The jQuery version should be set explicitly to be stable
- A page can have jQuery more than once, but it should be enough once.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.