jQuery Selector [attribute|=value] select by language name
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("a[hreflang|='en']").css("background-color", "yellow");}); </script>//from w w w .ja va 2 s .com </head> <body> <a href="https://java2s.com" hreflang="en">java2s.com</a><br> <a href="https://java2s.com" hreflang="en-us">java2s.com</a><br> <a href="https://java2s.com" hreflang="us-en">java2s.com</a><br> <a href="https://java2s.com" hreflang="fr">java2s.com</a> <p>This selector selects both "en" and "en-us".</p> </body> </html>