Delphinidin

Get any informations you need in depth explanation

Selectors, an essential feature of the jQuery library, are powered by the jQuery Sizzle selector engine. Sizzle can be used with other languages, but its real power is best used with all the other jQuery methods. The syntax is easy to understand for Web designers who have a solid understanding of CSS and HTML. The jQuery Sizzle selector engine is JavaScript code written to handle selectors in jQuery. The selectors are common CSS and XPATH selectors with the addition of a few custom selectors.

The jQuery selector is a string expression that classifies a single or set of DOM elements to be known as the matched set and is ready to be worked with in jQuery. The selector is always declared directly after the jQuery alias ($). After DOM elements are selected and methods have been applied, the matched set becomes a jQuery object. jQuery objects allow you to add many diff erent types of methods including events, effects, traversal, manipulation, etc. A jQuery object is something that you may or may not encounter during your jQuery coding, but it's always there and it's important to be aware of.
The following code example shows how a selector is laid out in jQuery:

$(selector).method().

With a little practice, working with selectors in jQuery becomes second nature because many selectors are those you have worked with before using CSS. A selector is a way for you to navigate the Document Object Model (DOM), and, in its most basic form, allows you to select an element and the syntax is identical to CSS selector syntax, whether it's a ID, class, tag, or an attribute. Selectors are an essential component of any jQuery statement that you create.

When you use a selector, the statement you create automatically loops through all of the nodes in the DOM looking for the elements you have specifi ed in your selector. The result of this loop is also known as the matched set. Web designers who are profi cient with CSS and have a solid understanding of the DOM can pick up selectors quickly. The JavaScript parts that make up a selector are:

+ The jQuery alias (jQuery or $).
+ The DOM elements, which you are selecting, wrapped in quotes within the two parentheses.
+ Anything after the selector is the jQuery method, which you are applying. The jQuery method can do anything from adding CSS to animating elements on the page. The functions, also known as methods, perform the specified action and accept arguments in the parentheses.

0 comments:

Post a Comment

Site Info