dojo click function click() function

1
What i want to do is connect a buttons on click method to another buttons onclick action. So when the button is pressed it will press one of the menu bar options: dojo.connect(document.getElementById('dashDE'), 'onclick', function(e) { dojo.byId('dijit_form_Button_1').click(); }); I have found that the .click() functionality will do what i want but this only works in IE and not in FF or Chrome. Is there a way to get the onclick function from the button and then connect it to the other button or is there an alternative to .click() functionality? Thanks
asked
2 answers
1

After a little google search I found that you can do the following to trigger any event.

Html

<input type="text" id="test">
<script>
obj = document.getElementById("test");
Event.observe(obj,'change',function(){alert('hi');});
fireEvent(obj,'change');
</script>

Javascript

function fireEvent(element,event){
        if (document.createEventObject){
        // dispatch for IE
        var evt = document.createEventObject();
        return element.fireEvent('on'+event,evt)
        }
        else{
        // dispatch for firefox + others
        var evt = document.createEvent("HTMLEvents");
        evt.initEvent(event, true, true ); // event type,bubbling,cancelable
        return !element.dispatchEvent(evt);
        }
answered
1

Why exactly is this functionality needed? Even if this could work, it sounds terribly dirty.

Isn't there a normal way to connect the same functionality (microflow?) to the other button?

answered