简体   繁体   中英

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.

尝试利用属性包含选择器[name * =“ value”]

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM