Javascript examples for jQuery Selector:attribute ends with
The [attribute$=value] selector selects each element whose attribute ends with a string.
Parameter | Description |
---|---|
attribute | Required. attribute to find |
value | Required. string ending |
The following code shows how to select all <a> elements with a href attribute that ends with ".org":
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("a[href$='.org']").css("background-color", "blue");}); </script>//w ww . j a v a 2s . c o m </head> <body> <a href="http://www.java2s.com">java2s.com</a><br> <a href="http://www.google.com">Google.com</a><br> <a href="http://www.wikipedia.org">wikipedia.org</a> </body> </html>