Web Development with jQuery®

(Elliott) #1

Appendix B (^) ❘ 495
bapp02.indd 02/17/2015 Page 495
:target Selects the element based on the URI fragment, if a
fragment exists. For example, if you have the URL:
http://www.example.com#idName
:target would select the element in the
document with the id name idName.
:contains(text) Selects elements based on whether the text speci-
fi ed is present in the element’s content. For example,
:contents("Lorem Ipsum") matches:


Lorem Ipsum

and any other element
containing Lorem Ipsum anywhere in its text content.
:empty Selects elements that have no children (including text
nodes). For example, :empty matches
,
, or .
:has(selector) Selects elements that match the specifi ed selector. For
example, input:has(':checked') matches any ele-
ment that has a check box or radio with the
attribute checked="checked".
:parent Selects an element’s parent. Therefore, div:parent
matches all parents that have
children.
VISIBILITY FILTERS
The following selectors make selections based on whether an element is visible or invisible.
:hidden Selects all elements that are hidden or ele-
ments that are of type="hidden", depending on the
context of the selection. The concept of hidden applies
to either elements with CSS visibility: hidden; or
display: none;.
:visible Selects all elements that are visible—for example, they
are not hidden with visibility: hidden; or
display: none;.
AT TRIBUTE FILTERS
The following selectors make selections based on attribute presence or strings contained
within attribute values.
[attribute] Selects all elements where the specifi ed attribute is
present. For example, the selector [href] selects all
elements in a document that have an href attribute.
[attribute=value] Selects all elements where the attribute has an
exact match for the specifi ed value. For example,
[href="#"] matches all href="#" attributes in the
document (regardless of what element the attribute is
attached to).
continues
[http://www.it-ebooks.info](http://www.it-ebooks.info)
Free download pdf