forked from jquery/api.jquery.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattribute-starts-with-selector.xml
31 lines (31 loc) · 1.34 KB
/
attribute-starts-with-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
<?xml version="1.0"?>
<entry type="selector" name="attributeStartsWith" return="">
<title>Attribute Starts With 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 a <a href="https://www.w3.org/TR/css3-selectors/#attribute-selectors">valid identifier</a> or a quoted string.</desc>
</argument>
</signature>
<desc>Selects elements that have the specified attribute with a value beginning exactly with a given string.</desc>
<longdesc>
<p>This selector can be useful for identifying elements in pages produced by server-side frameworks that produce HTML with systematic element IDs. However it will be slower than using a class selector so leverage classes, if you can, to group like elements.</p>
</longdesc>
<example>
<desc>Finds all inputs with an attribute name that starts with 'news' and puts text in them.</desc>
<code><![CDATA[
$( "input[name^='news']" ).val( "news here!" );
]]></code>
<html><![CDATA[
<input name="newsletter">
<input name="milkman">
<input name="newsboy">
]]></html>
</example>
<category slug="selectors/attribute-selectors"/>
<category slug="version/1.0"/>
</entry>