/ Published in: JavaScript
If you have assigned an event handler to a container, you might want to remotely trigger it as if a child of the container had been clicked. That is, you might want to manually set the target of the 'event' object that is passed to the event handler on the container. This helps to keep the number of event handlers down.
Expand |
Embed | Plain Text
//assuming that 'menu' has an appropriate onclick handler: function simulateClick( itemToClick, menu) { if ( ! itemToClick.click ) { //== Non-IE: menu.onclick({target: itemToClick}); } else { //== IE: itemToClick.click() } }
You need to login to post a comment.
