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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

10<br />

CHAPTER 1 ■ INTRODUCING JQUERY<br />

■ Caution Certain other JavaScript libraries also use the $() function, so conflicts may occur when attempting to<br />

use multiple libraries simultaneously. <strong>jQuery</strong> provides a fix for this situation with <strong>jQuery</strong>.noConflict(). For more<br />

information, see http://docs.jquery.com/Core/<strong>jQuery</strong>.noConflict.<br />

Selecting DOM Elements Using CSS Syntax<br />

Everything in <strong>jQuery</strong> revolves around its incredibly powerful selector engine. The rest of this chapter<br />

teaches you the different methods with which you can select elements from the Document Object Model<br />

(DOM) using <strong>jQuery</strong>.<br />

■ Note The DOM is a collection of objects <strong>and</strong> nodes that make up HTML, XHTML, <strong>and</strong> XML documents. It is<br />

platform-<strong>and</strong> language-independent—this essentially means that developers can use a variety of programming<br />

languages (such as JavaScript) to access <strong>and</strong> modify DOM information on multiple platforms (such as web<br />

browsers) without compatibility issues.<br />

One of the strongest <strong>and</strong> most alluring features of <strong>jQuery</strong> is the ease with which a developer is able to<br />

select elements within the DOM. The use of pseudo-CSS selectors 1 adds an incredible level of power to<br />

<strong>jQuery</strong>. Pseudo-CSS allows a developer to target specific instances of elements in his HTML. This is<br />

especially helpful to anyone with prior experience with CSS due to the nearly identical syntax.<br />

Essentially, using the same CSS syntax you would use to set up style rules, you’re able to select elements<br />

in the following ways:<br />

• Basic selectors<br />

• Hierarchy selectors<br />

• Filters<br />

• Basic filters<br />

• Content filters<br />

• Visibility filters<br />

• Attribute filters<br />

• Child filters<br />

• Form filters<br />

1 http://www.w3schools.com/CSS/css_pseudo_classes.asp

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

Saved successfully!

Ooh no, something went wrong!