Applying backgroundColor property in a form
Hello, I'm trying to change the background color of a form. It seems simple, but no!!
I have tried several methods but none of them work for me, it does not change the background color of the bodysuit, but rather what is behind it.
With the debugger I have seen that there is the "body" and the "claro" class, but I cannot change the color of "claro", only the body that is behind "claro".
[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:bb63d6ba-a8ed-4391-8162-e2a125229adc:type=javascript&text=var%20cualColor%20%3D%205%3B%20%2F%2F%20Por%20probar%20un%20valor%0Avar%20elementoConClaseClaro%20%3D%20document.querySelector%28%27.claro%27%29%3B%0A%0A%2F%2F%20Verificar%20si%20se%20encontr%C3%B3%20un%20elemento%20con%20la%20clase%20.claro%0Aif%20%28elementoConClaseClaro%29%20%7B%0A%20%20if%20%28cualColor%20%3D%3D%3D%205%29%20%7B%0A%20%20%20%20elementoConClaseClaro.style.backgroundColor%20%3D%20%22red%22%3B%0A%20%20%7D%20else%20if%20%28cualColor%20%3D%3D%3D%2010%29%20%7B%0A%20%20%20%20elementoConClaseClaro.style.backgroundColor%20%3D%20%22blue%22%3B%0A%20%20%7D%0A%7D]
I have tried with:
- var body = document.querySelector('.clear');
- var body = document.body;
- var body = document.getElementById("clear");
and some more, but nothing.
I have noticed that it works, but it changes the color of the background, you can see it by a thin line at the bottom.
Esto veo en el debugger:
Too many thanks!!!
I was able to set the background color by modifying document.body.style.backgroundColor within an onFormPopulated Form Event. When I was attempting to modify just document.body.bgColor it was being overwritten by the default.css. Directly updating the style in the method code seems to have fixed the issue: