How to get JQuery.trigger('click'); to initiate a mouse click

The Solution to How to get JQuery.trigger('click'); to initiate a mouse click is


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.

http://api.jquery.com/click/

~ Answered on 2014-01-05 01:30:05


Most Viewed Questions: