Why is my code not working?
I want to check if the color of the paragraph is white(it is white because of the css) and when it is white i want to change it to black so it is visible
function myFunction() {
if (document.getElementById("lol").style.color === "white") {
document.getElementById("lol").style.color = "black";
}
}
p {
color: white;
}
<button onclick="myFunction()">Try it</button>
<p id="lol">adadada</p>