Im trying to add an event listener to a button so when its pressed it can add a value into a container.
<div className="grid-container">
<div>
<button id="redBet" className="redButton" onclick={this.handleBetsRed}>Place Red</button>
<div id="redSearch" class="ui search">
<input class="prompt" type="text" placeholder="Common passwords..." />
<div class="results">
<p className="para"></p>
</div>
</div>
</div>
The Button is inside the above code with the onclick to run the function below:
handleBetsRed = () => {
document.getElementsByClassName("redButton").addEventListener("click", () => {
console.log("Yeet")
})
}
this function is not inside any function and right above the render, return statements.