When the "Roll!" button is clicked, take the number of sides entered by the user in the input text box, generate a random number between 1 and the number of sides, and display it in the large div.
e.g. if the user enters 6
in the text box, generate a random number between 1
and 6
.
- If the user clicks on "Roll!" when the text box is empty, show an
alert
with the messagePlease enter a number of sides!
- If the user clicks on "Roll!" when the number in the text box is
0
, negative or not a number, show analert
with the messagePlease enter a valid number of sides!