简体   繁体   中英

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.

$("#click").submit()

from the console

Interestingly they should not have called the button "submit"

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM