You can pass an additional parameter to the function handler using the trigger() method:
// initiate the button $('#btn').click(function(e, data){ console.log(data); }); // later on I need to simulate a click with parameter $('#btn').trigger('click',{ param : 'simulated click' });
But if your goal is simply to check if the event was fired programmatically, you can check:
// initiate the button $('#btn').click(function(e){ if(e.isTrigger) { console.log('simulated click'); } });
source share