Frontend Development

JavaScript Auto-Clicker(s)

Submitted by Yondu, , Thread ID: 197769

Thread Closed

RE: JavaScript Auto-Clicker(s)

#7
prefer get element by id, because is more faster than search by className (because using id you will return the first element with id, when code return the element, break the search; And searching by className you will return more than one element, that's very slow)

i prefer that

```js
const elementId = "clicker";
const button = document.getElementById(elementId);

const taskId = setInterval(() => button.click(), 0);

const cancelAutoClick = () => clearInterval(taskId);
```

Users browsing this thread: 2 Guest(s)