Coda Chang Coda Chang - 1 year ago 76
Ajax Question

jQuery trigger click function via done not working

There is a button, click it, it will open a modal and fetch data via


Besides, there are some tabs on the modal. When the user click the button, it will open the modal and click the tab by default.

It's hard to describe, so I've written the following code.

$('#open_mission_btn > .the_btn').click().done(function(){

But it seems not work.

Answer Source

Trigger your click event in the success/done function of your ajax call

success:function(data) {

to set the default tab to be open if you are using bootstrap you can do the following:

$('#myTabs a[href="#default"]').tab('show');

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download