0

This.style.background

I assigned var color = this.style.background under a event listener function click and then compared it to a specific rbg color in a if statement but it is not working even if they are same

6th Dec 2019, 12:53 PM
akshat
akshat - avatar
1 Answer
0
style property only read the style properties from the element. for example <div style='background: #ff0'> it can read the style.background as rgb(255,255,0) but if you're using div{ background: #ff0 } style.background would be empty
6th Dec 2019, 1:01 PM
Taste
Taste - avatar