jQuery .click() events not working in Tabs element

Hi there,

I’m trying to trigger some jQuery when a new tab is selected using the .click() listener on the .tab-* elements, but it seems like the code is being ignored. I’ve even tried to do a single tab to simplify the process:

jQuery(function($) {
  $("#tab-26").click(function() {
    setTimeout(function() {
      $(window).trigger('resize');
  	}, 10);
  });
});

I set a breakpoint on this function in the developer console of Chrome, and strangely, it says it breaks on the initial page load, but never when I click on the tab. My guess is you’re preventing defaults somewhere…

Is there a way around this? Or at least, can you point me in the right direction?

Thanks in advance!
Matt

Hi Matt,

Please try with the class selector instead:

jQuery(function($) {
  $(".x-tabs-list button").click(function() {
    setTimeout(function() {
      $(window).trigger('resize');
  	}, 10);
  });
});

Hope that helps and thank you for understanding.

Seems to have worked. Thanks!

We are delighted to assist you with this.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.