A Note about JavaScript and jQuery Usage

In this book we’ll use a lot of JavaScript. In the past, it’s been common practice to load JavaScript files in the <head> section of the page and then use techniques like jQuery’s document.ready to wait until the Document Object Model (DOM) is ready for modification. However, it’s recommended practice to load all scripts at the bottom of the page, as this can result in better performance. So that’s what we’ll do. All scripts, including jQuery, will go at the bottom of the page, except for a few cases where we must alter the DOM before any elements load.

In addition, we’ll use jQuery where it makes sense. If we’re simply looking for an element by its ID, we’ll use document.getElementById. But if we’re ...

Get HTML5 and CSS3, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.