How to get active tab index from TabContainer

NealR picture NealR · Sep 9, 2012 · Viewed 14.4k times · Source

Currently I am using this line of code in my JavaScript

var tabIndex = $(':focus').attr('tabIndex'); 

However this constantly fails to get the active index.

Here is asp:TabContainer header in case this helps. I have also tried document.GetElementById, however to no avail as well.

    <asp:TabContainer ID="AdvOrBasicSearch" runat="server" ActiveTabIndex="0">

Answer

deostroll picture deostroll · Sep 9, 2012

They say a picture is worth a thousand words...

I have used jQuery here. With it it is simple to find what you want. Pay attention to the rectangled text in the pic.

Happy coding.

enter image description here