I am stumped as to why this simple Javascript bookmarklet fails.
javascript:(setInterval(function() {
var element = document.getElementById("observeBtn");
if (element != null) element.click();
}, 1000);)();
The error on the browser console is:
SyntaxError: missing ) in parenthetical
I've counted the parentheses, and they all match (7 left, 7 right).
All this function is supposed to do is check every second for whether the observeBtn
button exists on the web page, and if so, automatically press it.
Also, could someone explain what the last "();"
is for?