Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery tabs bind tabsselect or tabsshow not fired

I have problem with jquery tabs. If I bind to tabsselect or tabsshow events of tabs, they are not fired.

I am using latest jquery-ui 1.10.3 and there are no js errors in my webapp console.

Code:

$("#tabs").tabs();

$("#tabs").bind('tabsselect', function(event, ui) {
  alert(ui.index); // This is never displayed
  if (ui.index === 1 && plot1._drawCount === 0) {
    plot1.replot();
  }
  else if (ui.index === 2 && plot2._drawCount === 0) {
    plot2.replot();
  }
});
like image 556
Michal Avatar asked Dec 26 '22 20:12

Michal


1 Answers

The event is activate

$("#tabs").on('tabsactivate', function(event, ui) {
  var index = ui.newTab.index();
  alert(index); // This is never displayed
  if (ui.index === 1 && plot1._drawCount === 0) {
    plot1.replot();
  }
  else if (ui.index === 2 && plot2._drawCount === 0) {
    plot2.replot();
  }
});

Demo: Fiddle

like image 195
Arun P Johny Avatar answered Jan 13 '23 18:01

Arun P Johny