-
Notifications
You must be signed in to change notification settings - Fork 260
Expand file tree
/
Copy pathattribute-contains-word-selector.xml
More file actions
23 lines (22 loc) · 1.18 KB
/
attribute-contains-word-selector.xml
File metadata and controls
23 lines (22 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<entry type='selector' name="attributeContainsWord" return="" >
<sample>[attribute~="value"]</sample>
<signature><added>1.0</added>
<argument name="attribute" type="String">
<desc>An attribute name.</desc>
</argument>
<argument name="value" type="String">
<desc>An attribute value. Can be either an unquoted single word or a quoted string.</desc>
</argument></signature>
<desc>Selects elements that have the specified attribute with a value containing a given word, delimited by spaces.</desc>
<longdesc><p>This selector matches the test string against each word in the attribute value, where a "word" is defined as a string delimited by whitespace. The selector matches if the test string is exactly equal to any of the words.</p> </longdesc>
<example>
<desc>Finds all inputs with a name attribute that contains the word 'man' and sets the value with some text.</desc>
<code><![CDATA[$('input[name~="man"]').val('mr. man is in it!');]]></code>
<html><![CDATA[<input name="man-news" />
<input name="milk man" />
<input name="letterman2" />
<input name="newmilk" />]]></html>
</example>
<category slug="selectors/attribute-selectors"/>
<category slug="version/1.0"/>
</entry>