简体   繁体   中英

jQuery UI Tab, set tab passive and active

I've 3 tabs. I want to set tab1 active and set another tabs passive. Only on first page load, It must be like that.

 <div id="tabs">
        <ul>
            <li><a href="#tabs-1">first</a></li>
            <li><a href="#tabs-2">second</a></li>
            <li><a href="#tabs-3">third</a></li>
        </ul>
        <div id="tabs-1">
        ...

Disable a tab. The selected tab cannot be disabled. To disable more than one tab at once use:

$('#example').tabs("option","disabled", [1, 2, 3]);

The second argument is the zero-based index of the tab to be disabled. Instead of an index, the href of the tab may be passed.

http://jqueryui.com/demos/tabs/#method-disable

You could probably trigger a click event on the first tab on DOMReady. Something like:

$("#tabs ul li:first-child a").click();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM