TabControl.SelectedItem

Syntax

SelectedItem: PP.TabItem;

Description

The SelectedItem property determines the selected tab.

Comments

Only one tab can be selected in the component at the same time. Selecting a tab means opening its contents.

The first tab is selected by default.

The user can also select a tab using the TabControl.SelectedIndex property.

Example

To execute the example, connect the PP.js components library and the PP.css visual styles table. Create the TabControl component.

<script type="text/javascript">
    //Create the TabControl component:
    var tabcontrol = new PP.Ui.TabControl({
            //Identifier for the div tag
            ParentNode: document.getElementById("tabcont1"),
            Width: 250,
            Height: 50,
            //Path to the folder with images:
            ImagePath: "img"
        });
    //Add tabs to the TabControl component:
    tabcontrol.addItem(new PP.Ui.TabItem({Position: PP.LTRB.Top, Caption: "First tab"}));
    tabcontrol.addItem(new PP.Ui.TabItem({Position: PP.LTRB.Top, Caption: "Second tab"}));
    //Set whether the second tab is selected:
    tabcontrol.setSelectedItem(tabcontrol.getItems()[1]);
</script>

After executing the example the HTML page contains the TabControl component that consists of two tabs. The second tab is selected.

See also:

TabControl