Building a react application using createreactapp and encountering an issue with an if statement that checks the CSS display property of a div identified as step1:
const step1 = document.getElementById("step-1")
if (step1.style.display === 'block') {
console.log("true")
} else {
console.log('false')
}
The CSS styling for the div is defined as follows:
.step-1 {
display: block;
}
Despite this, the console consistently logs 'false' instead of 'true' when checking the if statement.
I've simplified the problem to focus on potentially hiding the div based on the CSS display property value check. Unfortunately, it's not functioning as expected.
Regarding the HTML structure, it consists of a basic div with some content:
<div className="step-1" id="step-1">
Some content ....
</div>