BrilliantBrains
BrilliantBrains

Reputation: 91

Jquery UI Tabs Disable

I am using jquery UI tabs, i want to disable the tabs. for that i have already setup my tab as describes below for the HTML and the Jquery. The tab control works fine but it doesn't disable the tabs.

<div class="tabs-container h-tabs">
<ul class="tabs">
    <li><a href="#">tab 1</a></li>
    <li><a href="#">tab 2</a></li>
    <li><a href="#">tab 3</a></li>
</ul>

<div class="tab-content">
    <div>Tab 1</div>
    <div>Tab 2</div>
    <div>Tab 3</div>
</div>
</div>
<script type="text/javascript">
    (function () {
        $(".tabs-container ul.tabs").tabs("div.tab-content > div", { tabs: 'a', effect: 'fade', fadeOutSpeed: -200, history: false, initialIndex: 1 });


       // DISABLE THE TABS
       $(".tabs-container ul.tabs").tabs("option","disable", [1,2,3]); // IT DOESN'T WORK!!!

    })();
</script>

Upvotes: 2

Views: 14794

Answers (2)

Rajesh
Rajesh

Reputation: 3778

Got it. Try below code. It should be "disabled" instead of "disable", and the indexes are zero-based:

$(".tabs-container ul.tabs").tabs("option","disabled", [0, 1,2]);

Upvotes: 5

Donovan Charpin
Donovan Charpin

Reputation: 3397

Im' not sure on your html, replace your html with this

<div id="tabs">
  <ul>
    <li><a href="#tabs-1">tab 1</a></li>
    <li><a href="#tabs-2">tab 2</a></li>
    <li><a href="#tabs-3">tab 3</a></li>
  </ul>
  <div id="tabs-1">
    Content tab1
  </div>
  <div id="tabs-2">
    Content tab2
  </div>
  <div id="tabs-3">
    Content tab3
  </div>
</div>

If you want to disable all your tab, try this code

$( ".tabs" ).tabs( "disable" );

disable()

Disables all tabs. This method does not accept any arguments.

Upvotes: 4

Related Questions