The click command is skipping a button click. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

The click command is skipping a button click.

I am using the command document.getElementsByClassName('classname')[i].click(); in a set interval but when it is clicking it skip a button between clicking 2 buttons But if i try simply using document.getElementsByClassName('classname')[0].click(); without a set interval it works fine..

10th May 2020, 2:21 PM
Hassan Raza
Hassan Raza - avatar
2 Answers
+ 2
Most probably that is happening because loop keeps running but the interval will stop for some amount of time. But let us see the actual code to figure out what's the problem.
10th May 2020, 2:50 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 1
I tried to figureout this problem i used the console.log(i); function in the loop but the value of i is running correctly.. and i still didn't figured out the problem..
10th May 2020, 5:55 PM
Hassan Raza
Hassan Raza - avatar