Arguments
jQuery('[attribute|=value]')
version added: 1.0
attribute
An attribute name.
value
An attribute value. Quotes are optional.
Description: Selects elements that have the specified attribute with a value either equal to a given string or starting with that string followed by a hyphen (-).
This selector was introduced into the CSS specification to handle language attributes.
Example
Finds all links with an hreflang attribute that is english.Full source
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript" language="javascript"> $(document).ready(function(){ $('a[hreflang|=en]').css('border','3px dotted green'); }); </script> </head> <body> <a href="example.html" hreflang="en">Some text with hreflang="en"</a> <a href="example.html" hreflang="en-UK">Some other text with hreflang="en-UK"</a> <a href="example.html" hreflang="ru">Some other text with hreflang="ru"</a> </body> </html>
Was this information helpful?

