<script>
//grab all the input values when submit button is clicked
const sub = document.getElementById("sub");
sub.addEventListener("click", (e) => {
e.preventDefault();
//get input values
var in1 = document.getElementById("in1").value;
var in2 = document.getElementById("in2").value;
var in3 = document.getElementById("in3").value;
var in4 = document.getElementById("in4").value;
var in5 = document.getElementById("in5").value;
//create an array for input values
const inputs = new Array();
inputs.push(in1, in2, in3, in4, in5);
//grab circle elements
var num1 = document.getElementById("num1");
var num2 = document.getElementById("num2");
var num3 = document.getElementById("num3");
var num4 = document.getElementById("num4");
var num5 = document.getElementById("num5");
//store circle elements in an array
var circles = new Array();
circles.push(num1, num2, num3, num4, num5);
//array to store random numbers
var generated = new Array();
for(i = 0; i < 6; i++){
//generate random numbers and update circle elements with them
let gen = Math.round(Math.random() * 38);
generated.push(gen);
circles[i].innerHTML = generated[i];
}
alert("test");//this doesn't pop up
});
Everything seems to be working fine until after the for loop. I can't get anything to run after that point and I'm not sure why. If I move the alert above the for loop, it works without any issues.
I even tried adding an alert after the for loop to see if it would run, but it didn't.