I have a tab on my page which contains tabs like this:
<ul>
<li class="3 tabs__item active uiTabItem" role="presentation" data-aura-rendered-by="79:126;a" data-aura-class="uiTabItem" data-original-width="183">
<a class="tabHeader" aria-selected="true" data-tab-name="3" tabindex="0" role="tab" aria-controls="73:126;a" title="Files & Contacts" href="?tabset-563b2=3" data-aura-rendered-by="80:126;a" data-special-link="true">
<span data-aura-rendered-by="81:126;a">
</span>
<span class="title" data-aura-rendered-by="83:126;a">Files & Contacts</span>
</a>
</li>
</ul>
Within the code I'd like to get the tab label in String format. So for the code above I'd like to return "Files & Contacts
", I'd like to do this using just vanilla JS as opposed to using jQuery or any other framework.
This is the code I have so far, I can target the correct active tab but not sure how to just retrieve the text:
var selectedTab = document.querySelector('.tabs__item.active');
console.log(selectedTab);