0
Can someone please tell me why css background color is not working
I have to use inline css background color to make this code run. So why it's not working with external css. It' is keep throwing error that style property is null. https://code.sololearn.com/Wn490jfvRgZC/?ref=app
6 Respuestas
+ 3
I think the problem is in the js function: Your function couldn't retrieve the current object colors. I changed it a little, see js.
https://code.sololearn.com/WsX8qmZSv7Ye/?ref=app
+ 2
Code works fine here, not sure what error you got, I don't see any. I click the button and the boxes switch colours no problem.
+ 1
Lisa,
Thanks it's working now
+ 1
var color1 = id1.style.backgroundColor;
var color2 = id2.style.backgroundColor;
id1.style.backgroundColor = color2;
id2.style.backgroundColor = color1;
0
Ipang
I don't know why it is not working on my device.
But thanks for your answer :)
Now it's fixed