Safari treats .click() as undefined since .click() does not exist for Safari. (I take it back; .click() works for me.: /) I ran into this problem while working on a similar problem . What I came up with, after a bit of research, etc., is the following to trigger click events in safari (like other browsers, of course):
var t = document.getElementById('someidhere'); if (document.dispatchEvent) { var o = document.createEvent('MouseEvents'); o.initMouseEvent('click', true, true, window, 1, 1, 1, 1, 1, false, false, false, false, 0, t); t.dispatchEvent(o) } else if (document.fireEvent) { t.fireEvent('onclick'); } else if (t.click()) { t.click() }
I don't know if this will work for your side of firefox, given that according to @ Dennis your code already works for firefox. Without the environment, to really test this, I shoot in the dark. Hope this works for you.
Daedalus
source share