knockout bind text label to dropdown value selected option text

Posted by Adam Levitt on Stack Overflow See other posts from Stack Overflow or by Adam Levitt
Published on 2012-06-23T03:11:50Z Indexed on 2012/06/23 3:16 UTC
Read the original article Hit count: 236

Filed under:
|
|

Is there a simple way to bind the textbox of a div to change based on the text value of the selected option in a dropdown on the same page?

<div data-bind="text: dropdownValue"></div>
<select>
  <option value="1">Value1</option>
  <option value="2">Value2</option>
</select>

Please note, I don't want to put the values into the select element using javascript. I'd like to bind to the value straight from the HTML. I can also include jQuery to make it work.

© Stack Overflow or respective owner

Related posts about data-binding

Related posts about dropdown