How to use [attribute$=value] Selector Method in JQuery

This article describe about [attribute$=value] Selector Method in JQuery.
  • 1970

Use [attribute$=value] Selector method in jQuery

This method is use to href attribute that ending with ".jpg".

The value is ends with ".org".

The Attributes selector is select all specific attributes.

The attribute value selector ends a specific string.

Example

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function () {

        $("a:[href$=.org]").css("background-color", "yellow");

    });

</script>

</head>

<body>

 

<a href="">dotnetheaven.com</a>

<br />

<a href="http://www.google.com">Google.com</a>

<br />

<a href="http://www.wikipedia.org">wikipedia.org</a>

</body>

</html>

Output

op1.jpg

You may also want to read these related articles here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2020 DotNetHeaven. All rights reserved.