Fire click event within function

How can i fire a click event within a javascript function? I do have the YUI library available to me.

myfunction(){
    document.getElementById("testbutton").onclick();
}

something like that... does yui have a solution that is browser neutral?

LVL 9
Andrew MaurerAsked:
Who is Participating?
 
fermieCommented:
please try this
document.getElementById("testbutton").click();

Open in new window

0
 
Andrew MaurerAuthor Commented:
document.getElementById("bttnSubmitSearchBySize").click is not a function
[Break on this error] document.getElementById("bttnSubmitSearchBySize").click();
0
 
Andrew MaurerAuthor Commented:
thats in FireFox
0
 
Andrew MaurerAuthor Commented:
it does work in IE... but not FF
0
 
Andrew MaurerAuthor Commented:
I want this solution in the EE database so I will accept the answer, but it is incomplete. Seems that click() method does not exist in FF and therefore.. should be avoided because it is browser specific. I have looked high and low for an answer and what I've come up with is, you cant use click() in FF.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.