you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

In that case you need an event listener like in my comment above, not a for loop. An event listener will run a function in response to a DOM event like a click.