forked from jquery/api.jquery.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattribute-contains-word-selector.xml
32 lines (32 loc) · 1.3 KB
/
attribute-contains-word-selector.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?xml version="1.0"?>
<entry type="selector" name="attributeContainsWord" return="">
<title>Attribute Contains Word Selector [name~="value"]</title>
<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>