value

The value() method, called without any parameters, will return the selected items’s value of the DropDown widget.
The value(valueToSelect) method is used to select item by its value.


<select id="ddl" ></select>

<script type="text/javascript">

    $(function () {
        $("#ddl").shieldDropDown({
            dataSource: {
			    data: countries
		    },
            enabled: false,
		    textTemplate: "{name}",
		    valueTemplate: "{code}"
       });
    });

    // return empty array 
    $("#ddl").swidget().value(); 
    
   // select the item with value (in this case {code}) equals to 1
    $("#ddl").swidget().value(1) 
   
    // return array with one element - the selected item's value - 1 
    $("#ddl").swidget().value(); 

</script>