jQuery UI Widgets Forums Navigation Tabs How to tell if a tab is enabled?

This topic contains 3 replies, has 2 voices, and was last updated by  ivanpeevski 3 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • How to tell if a tab is enabled? #120997

    ajcs
    Participant

    I can use enableAt or disableAt to set if a tab is enabled.

    How can I tell if a tab is enabled? Is there an isEnabledAt?

    Thanks

    How to tell if a tab is enabled? #120998

    ivanpeevski
    Participant

    Hi ajcs,

    The following code will return true, if a given tab is enabled, and false, if it is disabled:
    !document.querySelectorAll(".jqx-widget-header")[index_of_tab].classList.contains('jqx-fill-state-disabled')

    You can have a look at the example here:
    https://jsfiddle.net/3gusacL9/2/

    Please let me know if this fixes your issue!
    If you have any other problems, do not hesitate to contact us again.
    Best Regards,
    Ivan Peevski
    jQWidgets team
    https://www.jqwidgets.com

    How to tell if a tab is enabled? #120999

    ajcs
    Participant

    Sorry I don’t see the jqxTabs control in your example?

    In addition to telling if a tab is enabled, how can I get a count of the tabs?

    Thanks

    How to tell if a tab is enabled? #121000

    ivanpeevski
    Participant

    Hello ajcs,

    I apologize for the confusion.
    You can use the following code to get the state of a tab. Here #jqxTabs represents the id of your jqxTabs element:
    var state = !document.querySelectorAll("#jqxTabs .jqx-tabs-title")[index_of_tab].classList.contains('jqx-fill-state-disabled');

    You can invoke the length method to get the count of the tabs. For example:
    var tabsCount = $('#jqxTabs').jqxTabs('length');

    Please have a look at the example here:
    https://jsfiddle.net/q0gb9rvj/2/

    I hope this will fix your issue.
    Best Regards,
    Ivan Peevski
    jQWidgets team
    https://www.jqwidgets.com

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.