Jesse Joseph Jesse Joseph - 1 year ago 77
Javascript Question

How to get Tab1 which is an active tab as string into a variable in javascript

<button class="tab-page tab-active" data-tabid="Tab1">Tab1</button>

How to get Tab1 as variable through class Name?

Answer Source

Vanilla Javascript:

Docs: .getElementsByClassName() & .getAttribute()



Docs: .attr()


jQuery >= 1.4.3

Docs: .data()

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download