So, I have this code, in order to make a button autoclick.
Here is some code:
var int;
x = document.querySelectorAll("button");
for (var i = 0; i < x.length; i++) {
function yeet() {
x[i].click();
}
x[i].onmouseenter = function() {
int = setInterval(yeet, 0);
};
x[i].onmouseleave = function() {
clearInterval(int);
};
}
<button>one</button>
<button>two</button>
The interval works, and hovering does repetitively does an action fast. However, the console says "Can't read properties of undefined (reading click)". Therefore, it doesn't auto-click any button. Does anyone know a solution? As always, thanks so much for responding!!! :D