Here is the button on the page:
<a id="dispatchOnJobButton" class="ui-btn ui-btn-corner-all ui-shadow ui-btn-up-c" href="#" data-role="button" data-theme="c" data-disabled="false">
<span class="ui-btn-inner ui-btn-corner-all" aria-hidden="true">
<span class="ui-btn-text">Dispatch on next job</span>
</span>
</a>
I need Greasemonkey to click it. I tried many different methods, but none seem to fire whatever function it is supposed to run.
var clickEvent = document.createEvent("MouseEvents");
clickEvent.initEvent("click", true, true);
document.getElementById('dispatchOnJobButton').dispatchEvent(clickEvent);
// also tried
document.getElementById('dispatchOnJobButton').click();
// and this
unsafeWindow.document.getElementById('dispatchOnJobButton').click();
any ideas on something else I could try?
Not every button works off a click event. Also, it's not clear if this is a statically loaded button, or if it's loaded by AJAX. (Link to the target page!)
A general approach is given in Choosing and activating the right controls on an AJAX-driven site.
Something like this complete script will work in 99% of the cases:
If it doesn't work for you, Link to the target page, or post an SSCCE!