One of the most interesting aspects of the jQuery library is the use of selectors to decide which items a page will be affected by the operations that this library offers. Its syntax is based on CSS selectors.
A selector is an expression that identifies a number of elements in the document model (DOM), gathered in a structure similar to an arrangement on which you can make calls to jQuery. JQuery calls typically have form
$ ('selector'). (...); Method For example: $ ('a'). AddClass ('light'); Select all brands of the page and add them dynamically light class. handled in jQuery selectors three groups: basic selectors, the selectors and selectors particular positional jQuery.
basic selectors
| Selector | Description |
|---|---|
| "*" | Any item on the page. |
| "E" | Any item with the brand name E. |
| "EF" | All branded items descendants of E. F |
| "E> F" | All name brand items with direct children of E. F |
| "E + F" | all branded items named F with an element E that immediately precedes the same level. |
| "E ~ F" | All items with brand name E F with an element that precedes the same level. |
| "E: has (F)" | All name brand items with E that has at least one offspring with brand name F. |
| "Ec" | All name brand items with E that have the kind of name c. When omitted, E is identical to a selector "*. c" . |
| "E # i" | All items E brand name whose id attribute has value i. When omitted, E is identical to selector "* # i" . |
| "E [a]" | All name brand items with E that have an attribute to any value. |
| "E [a = v]" | All name brand items with E that have an attribute whose value is exactly v. |
| "E [a ^ = v]" | All name brand items with E that have an attribute whose value begins with v. |
| "E [a $ = v]" | All items Branded E that have a name attribute whose value ends with v. |
| "E [a *= v]" | All name brand items with E that have an attribute whose value contains v. |
positional selectors
| Selector | Description |
|---|---|
| "B: first" | First item on the page that corresponds to the selector B. |
| " B: last " | last element of the page that corresponds to the selector B. |
| "B: first-child" | selection elements B which are first child. |
| "B: last-child" | selection elements B which are last child. |
| "B: only-child" | selection elements B which are only child. |
| "B: nth-child (n)" | selection elements B which are yet another child from one spot. |
| "B: nth-child (odd is considered odd | |
| selection elements B are even. | |
| selection elements B are odd. | |
| The nth element of the selection B starting from zero. | |
| selection elements B following the nth element starting from zero. | |
| selecting items that precede the nth B element counting from zero. |
| selection B elements that are currently being encouraged by some of the methods jQuery animation. | |
| selection B elements are buttons, ie button, iput [type = submit], iput [type = reset] or iput [type = button]. | |
| selection Elements Iput type B [type = checkbox]. | |
| selection B elements that have been enabled. | |
| selection iput type B [type = file]. | |
| selection header type B, type ie h1, to h6. | |
| selection B elements that are hidden. | |
| selection iput type B [type = image]. | |
| selection B elements that are input fields, ie imput, select, textarea and button. | |
| Elements that do not filter selection B with f, a filter is any selection switches begin with a colon (:). | |
| selection B Don parents of a nonempty collection of children. | |
| Elements iput selection of type B [type = password]. | |
| elements of B-type selection iput [type = radio]. | |
| Elements of B-type selection button [type = reset]. | |
| selection of B elements, which are in selected state. | |
| elements of B-type selection iput [type = submit] the button [type = submit]. | |
| elements of B-type selection iput [type = text]. | |
| selection B elements that are not hidden. |
0 comments:
Post a Comment