values

The values() method, called without any parameters, will return all selected items’s values of the ListBox widget.
The values(valuesToSelect) method is used to select items by their values.


<div id="listbox" ></div>
<script type="text/javascript">
    $(function () {
        $("#listbox").shieldListBox({
            dataSource: {
			    data: countries
		    },
            textTemplate: "{name}",
            valueTempate: "{id}"
        });
    });

    $("#listbox").swidget().values(); // return empty array
  
    $("#listbox").swidget().values(1) // select the item with value equals to 1
  
    $("#listbox").swidget().values(); // return array with one element - the selected item's value - 1 

</script>