Wijmo UI for the Web
selectedIndex Option

Default value: 0

A value that specifies the index of the item to select when using single mode.

Syntax
Javascript (Usage) 
$(function () {
    
    // Get value
    var returnsValue; // Type:  number
    returnsValue = $(".selector").wijcombobox("option", "selectedIndex");
    
    // Set value
    var newValue; // Type:  number
    $(".selector").wijcombobox("option", "selectedIndex", newValue);
        
});
Javascript (Specification) 
var selectedIndex : number;
Example
//To get the selected item using the selected index:
     var selectedIndex = $("# tags ").wijcombobox("option","selectedIndex");  
     var selectedItem = $("# tags ").wijcombobox("option","data")[selectedIndex];
 // To set the selected item using the selected index:
     $("#tags").wijcombobox("option"," selectedIndex", 5);
Remarks
If the selectionMode is "multiple", then this option could be set to an array of Number which contains the indices of the items to select. If no item is selected, it will return -1.
Browser Compatibility
7
5
5

See Also

Reference

options type
wijcombobox jQuery Widget

 

 


© 2013 All Rights Reserved.

Send comments on this topic.