Zusammenfassung der Ressource
jQuery Retrieving Page Content
- Selectors & Filters retrieve
content from the document
- selectors retrieve an array of
objects as per the selection criteria
- this array is not the
set of DOM elements
- it is the collection of jQuery objects
that provide pre-defined functions for
further operating on objects
- fiilters operate on selectors to further refine
the results array that the selectors return
- jQuery Selector
- Basic jQuery Selector
- tagname
- all elements that are named tagname
- #identifier
- element with ID of identifier
- .className
- all elements with CLASS attribute of className
- tag.className
- all elements of type tag with CLASS attribute of className
- tag#id.className
- element of type tag with ID of id and CLASS attribute of className
- *
- all elements of the page
- Hierarchical jQuery Selector
- selector, selector, ...
- all specified selectors
- .class1.class2
- all elements with both class1 & class2 applied
- parent > child
- all child elements that are children of element of type parent
- ancestor descendant
- all descendant elements tht are contained within element of type ancestor
- prev + next
- all next elements that are next to a prev element
- prev ~ siblings
- all sibling elements that comes after prev and match the siblings selector
- jQuery Filters (provides fine grained
control over the elements selected)
- 1. Basic
- basic filtering like getting first,
last and even and odd numbered
elements in a returned set
- 2. Content
- filters a set of elements based on
their content, like whether the element
contains a particular string
- 3. Visibility
- filters a set of elements
based on their visibility setting
of each element as a test
- 4. Attribute
- Examines a given attribute of
an element to determine
whether it should be filtered out
- 5. Child
- Selects elements based
on their relationship with
their parent element
- 6. Form
- Provides specialized filters
that operate on form elements
- Retrieving
Page Content
- size(), length
- number of elements
in jQuery result set
- get()
- returns an array of
matched DOM elements
- get(index)
- access a single DOM
element at a specified
index in matched set
- find(expression)
- searches for descendant
elements that matches
the specified expression
- each(fn)
- executes a function within the
context of every matched element