Katie
Katie

Reputation: 751

detect certain value in style attribute and change it

I thought the following code would work for my needs

$("td[style='background-color: #FFBBBB']").css('background-color', '#333');

but the problem I am facing is that each td has different values within the style attribute for instance:

font-weight: normal;background-color:#FFBBBB; and the code above doesn't seem to execute since there are multiple values. How can I account for this?

Essentially I want to change elements with the background color of #FFBBBB to another color.

Upvotes: 0

Views: 57

Answers (1)

guest271314
guest271314

Reputation: 1

Try utilizing Attribute Contains Selector [name*="value"]

$("td[style*=#FFBBBB]").css("background-color", "#333");

Upvotes: 1

Related Questions