Knockout provides several different bindings that work with specific form elements.
valuebinding is used with
textInputbinding is also used with
textareaand is quite similar to the
valuebinding. When the
textInputis used, the observable updates with every user interaction, as opposed to the
valuebinding, which defaults to updating when the form element changes (typically when the field loses focus). See Example 5-1.
checkedbinding is used with checkboxes and radio buttons.
optionsbinding is used on the
selectform input to populate the list of options available in the drop-down list.
selectedOptionsbinding is also used with the
selectform input; more specifically when you are using a multiselect list. This is commonly bound to an observable array, as opposed to an observable variable.
disablebindings work with all form inputs to either enable or disable the form element when the condition results to true or false, respectively.
All of these bindings are what Knockout calls two-way bindings. This means that when the form element is changed, your ViewModel property is updated and if you programmatically change the observable, the form element it is binded to will be automatically updated.
<title>Data Binding with KnockoutJS