'Execute a function on a site which is normally executed by clicking a button

I am trying to execute a function on a site which is normally executed by clicking the button, without clicking the actual button (so either through the console or another way)

site: https://clickthatbutton.com/

As you can see on the site once you click the button it adds a click to this sentence: "7 CLICKS FROM YOU... THANK YOU". I want to run the function that adds 1 click to that sentence without clicking the button or changing the number in elements.



Solution 1:[1]

$("#click").submit()

from the console

Interestingly they should not have called the button "submit"

Solution 2:[2]

You first need to find the element you want to target, in this case the id is #submit. Then you can use the native function click() on it.

document.querySelector('#submit').click()

The website exoses Jquery but this can perfectly be done with native functions.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2