Sasu Sasu - 2 months ago 10
jQuery Question

Trigger an event created by .on()

I have a jQuery event defined as follows :

$('#pagebody').on('click', '#serverCompTab', function () {
toggleTabs('#serverComp', '#serverCompTab');
});


I would like to trigger this event manually on my code like
$('#'serverCompTab].onclick();


Can anyone help me with this?

Answer

You were really close. $('#serverCompTab').click() should take care of it for you.

Comments