Page 1 of 1

tab change detection

Posted: Sat Apr 21, 2018 11:26 pm
by Timo
In an edit form, there are some tabs. When the form loads, I run some PHP procedures to dynamically load some content. This loading should only happen, when a certain tab is selected.
To put it differently, I need to detect when another tab in an edit form is selected so that I can then run some JavaScript code. How to detect a tab change, is there an event?
I read similar questions but there has not been an answer.

Re: tab change detection

Posted: Sun Apr 22, 2018 2:20 am
by admin
Timo,

I hope this helps...

Code: Select all

$('.nuTabSelected')[0].id
tabs.PNG
Steven

Re: tab change detection

Posted: Sun Apr 22, 2018 6:36 am
by Timo
How does this detect when another tab is selected? This retrieves just the id of the selected tab, doesn't it?

Code: Select all

$('.nuTabSelected')[0].id
I'm looking for an event. Thank you.
How to detect a tab change, is there an event?

Re: tab change detection

Posted: Sun Apr 22, 2018 6:44 am
by admin
Timo,

There isn't an event for that.

You need to create your own.

Code: Select all

$( ".nuTab" ).click(function() {
  alert( "Handler for .click() called." );
});
Steven

Re: tab change detection

Posted: Sun Apr 22, 2018 6:48 am
by Timo
Works, thank you :D

Re: tab change detection

Posted: Sun Apr 22, 2018 6:50 am
by admin
.