random number text in html

Solutions on MaxInterview for random number text in html by the best coders in the world

showing results for - "random number text in html"
Brooke
27 Mar 2020
1<button class="button" onclick="RandomID();" style="font-family: sans-serif;">RUN</button>
2<input class="input" type="text" id="id" name="id" size="3" readonly />
Isabel
03 Nov 2016
1function RandomID() {
2  var value;
3  var rnd = Math.floor(Math.random() * 11);
4
5  if (rnd === 7)
6    value = "Wassup";
7  else if (rnd <= 5)
8    value = "Hello";
9  else
10    value = rnd;
11
12  document.getElementById('id').value = value;
13}