Home > Software design >  Execute a function on a site which is normally executed by clicking a button
Execute a function on a site which is normally executed by clicking a button

Time:02-16

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.

CodePudding user response:

$("#click").submit()

from the console

Interestingly they should not have called the button "submit"

CodePudding user response:

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.

  • Related