I'm trying to make my main div's "display:'none'" after a button press. But it's returning an error which appears to state that the getElementByID field is null.
Here's the code snippets that I'm working with:
<div className="content" style={Style}>
<ButtonGroup variant="contained" color="primary" size="large">
<Button onClick={() => {this.loadtrainingresources()}}>TRAINING RESOURCES</Button>
</ButtonGroup>
</div>
loadtrainingresources = () =>{
document.getElementById("content").display = "none";
}
You forgot style
document.getElementById("content").style.display = "none";