I'm using VS2010 on windows XP, Jquery-1.7.1.min.js, knockout-2.1.0.js, my browser is IE8. trying to make a simple biding with array and :
here is the code:
//my.js:
$(function () {
function tvm() {
// Array
this.tickets = [
{ name: 'A', price: 125 },
{ name: 'B', price: 128 },
{ name: 'C', price: 145 }
];
// this will hold the selected value
this.chosenTicket = ko.observable();
}
ko.applyBindings(new tvm());
});
//html:
<select
data-bind="options: tickets,
optionsCaption:'choose...',
optionsText: 'name',
value: chosenTicket">
</select>
<p data-bind="with: chosenTicket">
<b data-bind="text: name"></b>
<b data-bind="text: price"></b>
</p>
when running this I can see the select element with its data(until now everything good), when try to select a value from the select element I get the following error message: "Could not set the selected property. unspecified error"
Any idea how to fix this problem?(couldn't find help on the forums),
Check the jsFiddle for the same http://jsfiddle.net/rupesh_kokal/wPzNQ/
The code what you have written works fine with the latest from knockout js.
You might want to cross-check the version of jsFiddle once.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With