Skip to content
Advertisement

How to use simulate the action of clicking button with jQuery or JavaScript?

I need to use JavaScript to simulate the action of clicking buttons. How do I achieve it? Can I achieve it with jQuery?

Advertisement

Answer

Yes, you can do it with jquery. Use trigger function. Here documentation. Here is sample:

$('#foo').trigger('click');
Advertisement