I saw this $("a[rel~='single']")
somewhere. What is the operator ~=
in jquery?
Does anyone know where the documentation for that is?
Thanks in advance.
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:
<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
jQuery documentation for the tilde selector can be found here:
http://api.jquery.com/attribute-contains-word-selector/
Attribute Contains Word Selector [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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With