代码改变世界

Jquery的属性选择器

2010-02-25 19:53  AnyKoro  阅读(204)  评论(0编辑  收藏  举报

Attribute Filters:Note: In jQuery 1.3 [@attr] style selectors were removed (they were previously deprecated in jQuery 1.2). Simply remove the '@' symbol from your selectors in order to make them work again.

NameType
[attribute] Returns: Array<Element(s)>
Matches elements that have the specified attribute. Note the "@" before the attribute name was deprecated as of version 1.2.
[attribute=value] Returns: Array<Element(s)>
Matches elements that have the specified attribute with a certain value.
[attribute!=value] Returns: Array<Element(s)>
Matches elements that either don't have the specified attribute or do have the specified attribute but not with a certain value.
[attribute^=value] Returns: Array<Element(s)>
Matches elements that have the specified attribute and it starts with a certain value.
[attribute$=value] Returns: Array<Element(s)>
Matches elements that have the specified attribute and it ends with a certain value.
[attribute*=value] Returns: Array<Element(s)>
Matches elements that have the specified attribute and it contains a certain value.
[attributeFilter1][attributeFilter2][attributeFilterN] Returns: Array<Element(s)>
Matches elements that match all of the specified attribute filters.