Training Guide: Programming in HTML5 with JavaScript and CSS3 Ebook

(Nora) #1

261


Chapter 6 Essential JavaScript and jQuery


CHAPTER 6 Essential JavaScript and jQuery


T


he flexibility of JavaScript is amazing. In the previous chapters, you learned how to add
JavaScript code to your webpage to provide dynamic changes to the page when an
event is triggered.
One of the biggest difficulties with webpage development is the differences among
different browsers, but this book is primarily focused on HTML5, CSS3, and JavaScript
(ECMAScript5.1). A completely separate book could be written that deals just with the dif-
ferences among browsers and browser versions.
In this chapter, you learn how to create objects, which are an important aspect of
JavaScript. You use objects to create entities, which are passed to and from the server, and
to encapsulate functionality that you want to modularize. You also need to extend objects
that others have created.
This chapter also introduces jQuery, the answer to writing browser-compatible code.
Although jQuery doesn’t solve all browser-compatibility issues, it does solve most of the
day-to-day issues that you encounter among browsers. In addition, jQuery is fun and easy
to use.

Lessons in this chapter:
■■Lesson 1: Creating JavaScript objects 262
■■Lesson 2: Working with jQuery 285

Before you begin


To complete this book, you must have some understanding of web development. This
chapter requires the hardware and software listed in the “System requirements” section in
the book’s Introduction.
Free download pdf