I want to use a random number result in a span id multiple times But even cloning or delegating the result only appears once in the result and others appear blank
I don't know how to do it could help me?
javascript
var min = 50;
var max = 150;
var play1;
var play2;
window.onload = function() {
play1 = Math.floor(Math.random() * (max - min + 1)) + min;
max = 10 - play1
document.getElementById("yourNumber").innerHTML = play1;
if (play1 < 10 ) {
play2 = Math.floor(Math.random()*(max-min+1)) + min;
} else {
play2 = Math.floor(Math.random() * 10) + 1;
}
document.getElementById("yourNumber1").innerHTML = play2;
}
HTML
(<span id="yourNumber"></span> user log)
(<span id="yourNumber1"></span> users logs)
(<span id="yourNumber1"></span> users logs)
(<span id="yourNumber1"></span> users logs)
(<span id="yourNumber1"></span> users logs)
thank you!
Try to clone and delegate the random number
Need display the other four results with a different number
replace id with class because it is a unique value
body
to change the values of the four elements, we need to use a loop.
since they are all enclosed in the same class, we use
querySelectorAllto get the nodes.