You need to use jQuery('#bar')[0].click();
to simulate a mouse click on the actual DOM element (not the jQuery object), instead of using the .trigger()
jQuery method.
Note: DOM Level 2 .click()
doesn't work on some elements in Safari. You will need to use a workaround.