02.06.2013 Views

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

C H A P T E R 1<br />

■ ■ ■<br />

Introducing <strong>jQuery</strong><br />

To fully underst<strong>and</strong> <strong>jQuery</strong> <strong>and</strong> its applications in modern web programming, it's important to take a<br />

moment <strong>and</strong> look back at where <strong>jQuery</strong> came from, what needs it was built to fill, <strong>and</strong> what<br />

programming in JavaScript was like before <strong>jQuery</strong> came around.<br />

In this chapter you'll learn about JavaScript libraries <strong>and</strong> the needs they seek to fulfill, as well as why<br />

<strong>jQuery</strong> is the library of choice for the majority of web developers. You'll also learn the basics of <strong>jQuery</strong>,<br />

including how to make the library available for use in your applications <strong>and</strong> how the core of <strong>jQuery</strong>—its<br />

powerful selector engine—works.<br />

Choosing <strong>jQuery</strong> over JavaScript<br />

JavaScript has a reputation for being rather unwieldy in web applications. A lack of consistent browser<br />

support, difficult debugging, <strong>and</strong> an intimidating syntax can make learning JavaScript feel impossible.<br />

To be fair, all the things that make JavaScript seem difficult are part of what make it so powerful, but<br />

that doesn't make it any more inviting to a novice web developer looking to add JavaScript to his arsenal.<br />

Underst<strong>and</strong>ing JavaScript Libraries<br />

The steep learning curve associated with JavaScript has been a sore spot for developers for years, <strong>and</strong> as<br />

frustrations grew, several ambitious developers started building JavaScript libraries, also referred to as<br />

JavaScript frameworks.<br />

These libraries aimed to simplify the use of JavaScript to make it more accessible to both new <strong>and</strong><br />

existing developers <strong>by</strong> creating easy-to-use control functions that remove some of the heavy lifting from<br />

everyday JavaScript tasks. Libraries are especially useful in the realm of Asynchronous JavaScript <strong>and</strong><br />

XML (AJAX) due to the complexity of performing the same tasks using straight JavaScript.<br />

JavaScript libraries aim to provide a simpler syntax for common tasks, which translates to a faster<br />

workflow for developers <strong>and</strong> a less intimidating learning curve for beginners. They also eliminate some<br />

of the headache involved in coding cross-browser JavaScript <strong>by</strong> doing all the compatibility checks for<br />

you within their built-in methods, which is a huge time-saver when coding.<br />

3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!