How to detect when a button is pressed on webview

Hi all, i want to know how to detect when a button is pressed on webview.

I tried the following code:

if(document.getElementById('free_play_form_button').clicked == true) { console.log("Prueba"); }

along with the On Console Message block, but i don’t get any result.

Just in case, here are my current blocks. The webview button is supposed to trigger a clock, who triggers a notification.

Imgur

Welcome !

Maybe Help You

Thanks, i’ve solved it with an event listener:

document.getElementById("free_play_form_button").addEventListener("click", displayDate);  function displayDate() {   console.log("Prueba"); }

But now i have another problem, i’ve set the clock to 1 hour, to trigger a notification. The problem is, the notification never appears. I tried with smaller timelapses (5 seconds, 1 minute, 5 minutes) but anything beyond that, the app ignores it completely.

I’m pretty sure it’s a background problem (the app “unloads” itself after some time)

There’s any way to solve that?

Use this extension to keep your app in the background without killing itself.