I have the following code. I am trying to make a dice roller. However, the button doesn't seem to be functioning. Any ideas what I am missing? Is my EJS incorrect?
<div class="dicecontainer">
<div class="dice"><p id="rollresult">Result</p></div>
<% function roll() { %>
<% var result = Math.floor(Math.random() * 6 + 1); %>
<% document.getElementById("rollresult").innerHTML=result; %>
<% }; %>
<button onclick="roll()">Roll Dice</button>
</div>