I want to do two click event in Javascript, 1 after another. First click code is working fine but the second click is not happening. For the second click, a window pops up after 0.5 seconds.
I am using the below code, I am new to JS and don't know what is the issue
var x = document.getElementsByClassName('artdeco-button--secondary');
for (var i = 0; i < x.length; i++ ){
x[i].addEventListener('click',function(){
document.getElementsByClassName('ml1').click();
});
}
document.getElementsByClassName('ml1')is returning an array or single element. maybe you still have to run a loop to click all the elements with class nameml1