Posts

Showing posts from June, 2019

generating random numbers in input box on button click javascript

<input type='text' id=" randid " name="some" value='15' /> <br/><br/> <button id=" xx ">Get new number</button> var input = document.querySelector('# randid '),       btn = document.querySelector('# xx '); btn.addEventListener('click', function() {   var MIN = 10000, MAX = 99999999;   input.value = Math.floor(Math.random() * (MAX - MIN + 1)) + MIN; });