Frontend Development

JavaScript Auto-Clicker(s)

Submitted by Yondu, , Thread ID: 197769

Thread Closed
Yondu
Marry Poppins Y'all
Administrators
Level:
36
Reputation:
190
Posts:
1.53K
Likes:
333
Credits:
3.51K
12-02-2021, 10:25 PM
#1
There's 2 different scripts I have, you may choose whichever one you would like to use. Both scripts achieve the same goal. Tongue


Code:
id = "clicker"
var button = document.getElementById("clicker");

setInterval(function()
{
    button.click()
}, 0)

Code:
var button = document.getElementsByClassName("btn btn-default")[0];

setInterval(function()
{
    button.click()
}, 0)
[Image: wsUuw16j6oyxLLRnnK.gif]

RE: JavaScript Auto-Clicker(s)

NCRRancho
Novice
Level:
4
Reputation:
0
Posts:
46
Likes:
8
Credits:
80
19-02-2021, 12:02 AM
#2
Well the same goal is good, but can you tell whic one is fastest and makes low processing time to compile?

RE: JavaScript Auto-Clicker(s)

Yondu
Marry Poppins Y'all
Administrators
Level:
36
Reputation:
190
Posts:
1.53K
Likes:
333
Credits:
3.51K
OP
19-02-2021, 12:04 AM
#3
19-02-2021, 12:02 AM
NCRRancho Wrote:
Well the same goal is good, but can you tell whic one is fastest and makes low processing time to compile?

I haven't tested this in a while. But I think they both just are more likely doing the same thing.

There isn't a specific faster and slower one.
[Image: wsUuw16j6oyxLLRnnK.gif]

RE: JavaScript Auto-Clicker(s)

NCRRancho
Novice
Level:
4
Reputation:
0
Posts:
46
Likes:
8
Credits:
80
19-02-2021, 12:09 AM
#4
19-02-2021, 12:04 AM
Yondu Wrote:
I haven't tested this in a while. But I think they both just are more likely doing the same thing.

There isn't a specific faster and slower one.
Well yeah, but when you get about 10k+ rows in code, it feels different

RE: JavaScript Auto-Clicker(s)

Yondu
Marry Poppins Y'all
Administrators
Level:
36
Reputation:
190
Posts:
1.53K
Likes:
333
Credits:
3.51K
OP
19-02-2021, 12:20 AM
#5
19-02-2021, 12:09 AM
NCRRancho Wrote:
Well yeah, but when you get about 10k+ rows in code, it feels different

To be honest I haven't really tested it out with 10k+ rows in code whoops.

This makes more sense.
[Image: wsUuw16j6oyxLLRnnK.gif]

RE: JavaScript Auto-Clicker(s)

komaludim
Newbie
Level:
1
Reputation:
0
Posts:
15
Likes:
0
Credits:
0
19-02-2021, 04:55 PM
#6
I prefer the first one code.

RE: JavaScript Auto-Clicker(s)

AnubisCore
Newbie
Level:
1
Reputation:
0
Posts:
16
Likes:
0
Credits:
8
30-08-2021, 05:26 AM
#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: 1 Guest(s)