I have something like that:
Html:
<label id="CustomerName" data-bind="text: name, attr: {'data-value': name}"></label>
Script:
var viewModel = {
name : ko.observable("Original Name");
}
ko.applyBindings(viewModel);
I want to be able to change the data attribute programmatically with the help of jQuery.
$("#CustomerName").data("value", "NewName");
After changing the value of the data attribute, I don't see my change back in the linked property of the viewmodel.
Is it a normal behavior of Knockout to not synching viewmodel properties bound to data attribute?
If the data attribute are not bidirectional, what would be the best way to do this? Hidden field?? You understand I don't want input field like textbox? Yeah! Ahhh ok,... :)
Thank you.