So I'm trying to create a random number generator in html using javascript to randomise and alert the user of the number generated. However I always get an error when getting my number which I don't experience when using codecademy. The code is:
<input type="button" value="Enter" id="enter"
onClick="alert(getRandomInt(document.getElementById('min').value,
document.getElementById('max').value));">
</div>
<script type="text/javascript">
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
When 5 and 10 are input as min and max numbers respectively,for example,the resulting numbers are 15,25,05,35 etc. The first digits apparently is found using the function
Math.floor(Math.random() * (max - min + 1))
and the last digit would be the number 5 which is the minimum. So I was wondering if anyone could teach me how to put the + min into the entire operation so I can get a number within the range of 5-10? Thanks in advance