YUI Library Home

YUI Library Examples: TabView Control: Adding Tabs

TabView Control: Adding Tabs

This demonstrates how to dynamically add tabs to a TabView widget.

Tab One Content

Tab Two Content

Tab Three Content

Adding Tabs to a TabView

Dynamically adding tabs to a YUI TabView widget is done with the addTab method.

We will create a <div> called demo and include the TabView markup:

Next, create an instance of TabView from our demo element:

For this example, a simple prompt will accept the new tab label and content. We will need a function to accept the input, create, and add the new tab:

This is a basic example of the TabView's addTab method.

Configuration for This Example

You can load the necessary JavaScript and CSS for this example from Yahoo's servers. Click here to load the YUI Dependency Configurator with all of this example's dependencies preconfigured.

Copyright © 2009 Yahoo! Inc. All rights reserved.

Privacy Policy - Terms of Service - Copyright Policy - Job Openings