Mdb
Mdb

Reputation: 8568

Return the selected value from a dropdown list. Knockout

I am new in javascript and I am currently researching the knockoutjs library. Here is my question. I have a select list populated from an observable array. When I select a value from the select list and click the save button, I want this value to be saved in a variable which later I will send to the server. How can this be done? Thank You!

Fiddle: http://jsfiddle.net/PsyComa/xuHkJ/1/

Upvotes: 2

Views: 5633

Answers (1)

Niko
Niko

Reputation: 26730

The "knockout"-ish way would be to use the "value" binding:

<select data-bind="options: optionValues, value: selectedValue">

http://jsfiddle.net/xuHkJ/10/

Upvotes: 7

Related Questions