I have a html button that calls this function. But for unknown reason it only goes 3 iterations.
Can anyone help or refer me to some good example why the for loop breaks after the third iteration?
for(i = 1; i < 10; i++) {
alert(i);
if (document.getElementById(i).checked) {
alert("dda3");
act = act + document.getElementById("TD" + i).innerHTML + delimiter;
}
}
Probably you dont have an element with that ID and thats why it breaks the for loop , go try in the html part of your code where you initialize the names of the where you don’t increment or decrement if you do it correctly ( in while of for or foreach loop) maybe you are using the same $i variable for 2 different loops or changing its value (other than $i++ or $i–)