Change css depending on inline-style?

Hi, I would like to change the border-color of elements that has style=“background: #ffffff

Example:http://jsfiddle.net/91udjsb2/2/

If it has style=“background: #ffffff” i want the border-color to change to #eee from transparent

How could I do this?

Hi,

It’s a bit fragile but you could do this:

div[style="background: #ffffff;"]{border-color:#eee}
div[style="background: rgb(255, 255, 255);"]{border-color:#eee}/* ie*/

Something like this? I do something wrong tho because it aint working.

$('div[style="background: #ffffff;"]').css('border', '#eeeeee solid 1px');

You have “No-Library (pure JS)” selected. You’ll need to make sure jQuery is used for that example to work.

1 Like

doh… facepalm.

Is there a reason you are using js for this?

The css works on its own.

1 Like

facepalm on me again it seems… ofcourse i should use the CSS=)

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.