[Not resolved] Change color if () | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

[Not resolved] Change color if ()

how to do this in js : if (in the document you find red) { change red to blue; }

3rd Oct 2017, 5:09 PM
NoxFly
NoxFly - avatar
3 Answers
+ 4
it's exactly what I want but with the fill of a SVG ^^ thanks !
3rd Oct 2017, 6:01 PM
NoxFly
NoxFly - avatar
+ 4
I have 2 squares by svg (so <rect>) <svg fill='rgba (187,161,97,0.9)'> <rect id='...' clas='...' x='...' y='...' width='...' height='...' /> </svg> draggable when 2 squares intersect, their intersection become : rgba (187,161,97,1) And I want this intersection become #EEE so I want the rgba (187,161,97,1) become #EEE
3rd Oct 2017, 6:06 PM
NoxFly
NoxFly - avatar
+ 3
Hello. Here is a little example I've put together to demonstrate how you can filter all elements on a page by their background color values and then changes the background color of those elements (not sure if background color is what you're looking for, specifically, but this can be adjusted to account for other properties): https://codepen.io/dustinoverby/pen/aLLMYq?editors=1010
3rd Oct 2017, 5:56 PM
Shane Overby
Shane Overby - avatar