Download document : jQuery Selectors
Download document : jQuery Selectors
CONTENTS INCLUDE:
What are jQuery Selectors?
Types of jQuery Selectors
Basic CSS Selectors
Custom jQuery Selectors
Matched Set Methods
Hot Tips and more...
************
What are jQuery selectors?
Understanding jQuery selectors is the key to using the jQuery library most effectively. This reference card puts the power of jQuery selectors at your very fingertips.
A jQuery statement typically follows the syntax pattern: $(selector).methodName();
The selector is a string expression that identifies the set of DOM elements that will be collected into a matched set to be operated upon by the jQuery methods.
Many of the jQuery operations can also be chained: $(selector).method1().method2().method3(); As an example, let’s say that we want to hide the DOM element with the id value of goAway and to add class name incognito:
$(‘#goAway’).hide().addClass(‘incognito’);
Applying the methods is easy. Constructing the selector expressions is where the cleverness lies.
TYPES OF jQuery selectors
There are three categories of jQuery selectors: Basic CSS selectors, Positional selectors, and Custom jQuery selectors.
The Basic Selectors are known as “find selectors” as they are used to find elements within the DOM. The Positional and Custom Selectors are “filter selectors” as they filter a set of elements (which defaults to the entire set of elements in the DOM).
jQuery Custom Selectors
These selectors are provided by jQuery to allow for commonly used, or just plain handy, selections that were not anticipated by the CSS Specification. Like the Positional Selectors, these selectors filter a base matching set (which we denote with B).
Omitting B is interpreted as the set of all elements. These selectors may be combined; see the examples for some powerful selector combinations.......
Download document : jQuery Selectors
0 commentaires: