how to change background color of anchor using class and jquery

Posted by Klbaiju under jQuery on 7/1/2014 | Points: 10 | Views : 1248 | Status : [Member] | Replies : 2
Hi,

In my application gridview rendered like this

<a href="#" class="anchor3">Booked </a>

i want to change the background color of anchor with red if its text="BOOKED"

my requirement change background color of anchor where class=anchor3 and text="BOOKED"

How to solve this

Regards

Baiju




Responses

Posted by: Bandi on: 7/1/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer
http://stackoverflow.com/questions/10828219/onload-first-anchor-link-background-color-change
http://www.webdeveloper.com/forum/showthread.php?232382-Change-div-background-with-anchor-tag

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: kgovindarao523-21772 on: 7/3/2014 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi,
Here is the solution
$('.anchor3').each(function(){
var $this=$(this);
if($this.text().toUpper()=='BOOKED')
{
$this.css('background-color','red');
}
});

Revert back if any concerns.

Thank you,
Govind

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response