My code currently works how it should other than herb2 and herb3 not showing up or using the randomizer. I'm not very experienced with coding and have no idea how to make this work.
<!DOCTYPE html>
<html>
<body>
<br>
<p>- - - - - - - - - - - - - - -</p>
<p>D1X (MOD1)</p>
<p>
EPN419<br>
Tesla 1 (left): <span id="demo1"></span><br>
Tesla 1 (right): <span id="demo2"></span><br>
Tesla 2: <span id="demo3"></span><br>
Tesla 3: <span id="demo4"></span><br>
</p>
<script>
for (var x = 1; x < 4; x++) {
document.getElementById("demo" + x).innerHTML =
Math.floor(Math.random() * 8) + 2 + '0%';
}
</script>
</body>
</html
aelements.</a>idshould be unique within the document, andgetElementByIdwill return the first one it finds, so there’s no expectation here that all three elements would be modified.