Greasemonkey Button Click
Can anyone please help me with clicking this button using greasemonkey? http://mibpaste.com/te6fRR (Full Source)
Solution 1:
var evt = document.createEvent ("HTMLEvents");
evt.initEvent ("click", true, true);
document.getElementById('fight_btn').dispatchEvent (evt);
Solution 2:
Since createEvent
and initEvent
are now deprecated, the following uses the new MouseEvent()
constructor instead:
document.getElementById("fight_btn").dispatchEvent(newMouseEvent('click'));
You could use getElementsByClassName("fight_btn")[0]
instead of getElementById
, of course.
Post a Comment for "Greasemonkey Button Click"