How to get active tab in jQuery Ui Tabs?

Hi all. I have a little problem.
In General, working with jQuery UI Tabs and I need to catch the active tab and put in the class.

Markup:
the <ul>
 the <li><a href="#tabs-1"><i class="l-messages"></i></a></li>
 the <li><a href="#tabs-2"><i class="l-messages"></i></a></li>
 the <li><a href="#tabs-3"><i class="l-messages"></i></a></li>
</ul>


Ie, here's what I can't figure out (it adds all the icons this class, and you need only one active tab):
var tabs = $('.maintabs');
if(tabs.find(li.ui-tabs-active)){
$(this).find('i').addClass('active')
}


In General, you need to make it so that if this tab is active (li), that (li) find (i) and append the class active. How can I do this?

Thank you in advance.
September 26th 19 at 06:36
1 answer
September 26th 19 at 06:38
Solution
So the ui itself and adds an active class ui-tabs-active - code fairbaim you ever watched?

PS you Have a suspiciously similar links in tabs, this should not be...
This is the example I set. All I watched, but I can't why to catch the active tab and that's it (if it is active) to add the class active. - chaya_Kassulke commented on September 26th 19 at 06:41
I repeat my question.... Why do you have a class active, if the script itself generates the class ui-tabs-active on the active tab? - Brain.MacGyver commented on September 26th 19 at 06:44
Yes emae. Again, I need to assign a class to the CLASS ICONS in the active tab! - chaya_Kassulke commented on September 26th 19 at 06:47
api.jqueryui.com/tabs/#option-active
Please... if you fundamentally need to have your class. - Brain.MacGyver commented on September 26th 19 at 06:50
You are doing wrong. It can be easier, and not zaparivat with scripts.
If I understand you correctly, then the active sub tab the icon changes in style, right? So change it from the CSS.
that is:
ul li l-messages { simple styling}
ul li.ui-tabs-active l-messages { styles for activity} - Brain.MacGyver commented on September 26th 19 at 06:53
Well and, accordingly, simply do the extra classes for the li - type type_1, type_2...
ul li.type_1 .l-messages { just}
ul li.type_1.ui-tabs-active .l-messages { active}
etc. - Brain.MacGyver commented on September 26th 19 at 06:56

Find more questions by tags CSSjQuery