Search code examples
javascriptjqueryjquery-uitabs

jQuery tabs: how to hide single tab?


How do I hide the tab2? I can add ID to the second li and than hide it with jQuery, but isn't there some way to do it through .tabs directly?

<div id="tabs" style="width:100%">
<ul>
    <li>
        <a href="#tab1">
            Tab 1 Title
        </a>
    </li>
    <li>
        <a href="#tab2">
            Tab 2 Title
        </a>
    </li>
</ul>
<div id="tab1" style="width:100%;">
    content tab1
 ....

Solution

  • Try this :

    $('[href="#tab2"]').closest('li').hide();