option binding is used to get the option for the selected element which can be used for drop-down list of multi-select list but which can not be used in select elements the syntax of option binding as shown below.
[code]
options: <binding-array>
[/code]
The code below demonstrates the checked binding as shown below.
[html]
<!DOCTYPE html>
<head>
<title>KnockoutJS Options Binding</title>
<script src="https://ajax.aspnetcdn.com/ajax/knockout/knockout-3.3.0.js" type="text/javascript"></script>
</head>
<body>
<p>Tutorials Library:
<select data-bind="
options: availableTutorials,
value: selectedTutorial,
optionsCaption: 'Choose tutuorial...',
"></select></p>
<p>You have selected <b><span data-bind="text:selectedTutorial"></b></span>
<script type="text/javascript">
function ViewModel (){
this.selectedTutorial = ko.observable();
this.availableTutorials = ko.observableArray(['HTML','.NET','CSS','Java Technologies','Mainframe',
'Management','Microsoft Technologies','Mobile Development','Programming','Software Quality']);
};
var vm = new ViewModel();
ko.applyBindings(vm);
</script>
</body>
</html>
[/html]
Result
By running the above code in a preferred browser user can get the following output as shown in below image.
When the user selected the tutorial from the drop down list then it shows like below image.