jQuery | [attribute$=value] Selector
The [attribute$=value] selector is used to select each element with a specific attribute, with a specific ending string.
Syntax:
$("[attribute$='value']")
Parameter:
- attribute : This parameter is required to specify the attribute to find.
- value : This parameter is required to specify the string i.e. the value should end with.
Example-1:
<!DOCTYPE html> <html> <head> <script src= </script> <script> $(document).ready(function() { $("a[href$='.org']").css( "background-color", "green"); }); </script> </head> <body> <center> <h1>GeeksForGeeks</h1> <a href= geeksforgeeks.org </a> <br> <a href= Google.com </a> <br> <a href= wikipedia.org </a> </center> </body> </html> |
chevron_right
filter_none
Output:
Before click on links:

After click on GeeksForGeeks links:

After click on Google links:

After click on wikipedia links:

Example-2:
<!DOCTYPE html> <html> <head> <script src= </script> <script> $(document).ready(function() { $("h3[id$='.org']").css( "background-color", "green"); }); </script> </head> <body> <center> <h1>GeeksForGeeks</h1> <h3 id="geeksforgeeks.org/"> geeksforgeeks.org </h3> <h3 id="google.com"> Google.com </h3> <h3 id="wikipedia.org"> wikipedia.org </h3> </center> </body> </html> |
chevron_right
filter_none
Output:

Recommended Posts:
- jQuery | :has() Selector with example
- jQuery | :gt() Selector
- jQuery | :contains() Selector
- jQuery | :lt() Selector
- jQuery | :even Selector
- jQuery | :first Selector
- jQuery | :odd Selector
- jQuery | :last Selector
- jQuery | * Selector
- jQuery | :not() Selector
- jQuery | #id Selector
- jQuery | :submit Selector
- jQuery | :parent Selector
- jQuery | :file Selector
- jQuery | :last-child Selector
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



