I saw this $("a[rel~='single']")
somewhere. What is the operator ~=
in jquery?
我在什么地方见过这个$(“a[rel~='single'])。jquery中的运算符~=是什么?
Does anyone know where the documentation for that is?
有人知道文件在哪吗?
Thanks in advance.
提前谢谢。
5 个解决方案
#1
6
When the equal sign in an attribute selector is preceded by a tilde ( ~ ), that means that the selector will match if the value listed is any one of the space-separated values of the given attribute. So the first rule's selector, *[class~="urgent"] , will match any of the following elements:
当属性选择器中的等号前面有波浪线(~)时,这意味着如果列出的值是给定属性的空格分隔值之一,那么选择器将匹配。因此,第一条规则的选择器*[class~="urgent"]将匹配以下任何一个元素:
<p class="very urgent really">
<table class="urgent">
<ul class="not urgent">
<pre class="not terribly urgent but still worth knowing">
Source: http://meyerweb.com/eric/articles/webrev/200008b.html
来源:http://meyerweb.com/eric/articles/webrev/200008b.html
jQuery documentation for the tilde selector can be found here:
tilde选择器的jQuery文档可以在这里找到:
http://api.jquery.com/attribute-contains-word-selector/
http://api.jquery.com/attribute-contains-word-selector/
#2
2
Attribute Contains Word Selector [name~="value"]
属性包含字选择器[name~="value"]
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.
此选择器匹配属性值中的每个单词的测试字符串,其中“单词”定义为由空格分隔的字符串。如果测试字符串恰好等于任何一个单词,则选择器将匹配。
#3
2
it is a "attribute contains word" selector. It means that $("a[rel~='single']") will select every tag containing the "single" word in the rel attribute.
它是一个“包含字的属性”选择器。这意味着$(“a[rel~='single'])将选择rel属性中包含“single”单词的每个标记。
http://api.jquery.com/attribute-contains-word-selector/
http://api.jquery.com/attribute-contains-word-selector/
Cheers ;)
干杯,)
#4
1
Selects elements that have the specified attribute with a value containing a given word, delimited by spaces. See:: http://api.jquery.com/attribute-contains-word-selector/
选择具有指定属性的元素,该元素的值包含给定的单词,由空格分隔。见:http://api.jquery.com/attribute-contains-word-selector/
#5
1
Comes under attribute. jQuery custom attribute selector. attribute-contains-word-selector
受到属性。jQuery的自定义属性选择器。attribute-contains-word-selector
http://api.jquery.com/attribute-contains-word-selector/
http://api.jquery.com/attribute-contains-word-selector/
#1
6
When the equal sign in an attribute selector is preceded by a tilde ( ~ ), that means that the selector will match if the value listed is any one of the space-separated values of the given attribute. So the first rule's selector, *[class~="urgent"] , will match any of the following elements:
当属性选择器中的等号前面有波浪线(~)时,这意味着如果列出的值是给定属性的空格分隔值之一,那么选择器将匹配。因此,第一条规则的选择器*[class~="urgent"]将匹配以下任何一个元素:
<p class="very urgent really">
<table class="urgent">
<ul class="not urgent">
<pre class="not terribly urgent but still worth knowing">
Source: http://meyerweb.com/eric/articles/webrev/200008b.html
来源:http://meyerweb.com/eric/articles/webrev/200008b.html
jQuery documentation for the tilde selector can be found here:
tilde选择器的jQuery文档可以在这里找到:
http://api.jquery.com/attribute-contains-word-selector/
http://api.jquery.com/attribute-contains-word-selector/
#2
2
Attribute Contains Word Selector [name~="value"]
属性包含字选择器[name~="value"]
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.
此选择器匹配属性值中的每个单词的测试字符串,其中“单词”定义为由空格分隔的字符串。如果测试字符串恰好等于任何一个单词,则选择器将匹配。
#3
2
it is a "attribute contains word" selector. It means that $("a[rel~='single']") will select every tag containing the "single" word in the rel attribute.
它是一个“包含字的属性”选择器。这意味着$(“a[rel~='single'])将选择rel属性中包含“single”单词的每个标记。
http://api.jquery.com/attribute-contains-word-selector/
http://api.jquery.com/attribute-contains-word-selector/
Cheers ;)
干杯,)
#4
1
Selects elements that have the specified attribute with a value containing a given word, delimited by spaces. See:: http://api.jquery.com/attribute-contains-word-selector/
选择具有指定属性的元素,该元素的值包含给定的单词,由空格分隔。见:http://api.jquery.com/attribute-contains-word-selector/
#5
1
Comes under attribute. jQuery custom attribute selector. attribute-contains-word-selector
受到属性。jQuery的自定义属性选择器。attribute-contains-word-selector
http://api.jquery.com/attribute-contains-word-selector/
http://api.jquery.com/attribute-contains-word-selector/