I have simple textarea
that i want to customize it's text(like add break-lines), that's what I have tried so far:
<textarea rows="5" data-bind="value: function(data) { SetDefaultValue(data); }" />
but I get nothing.
When checking the resulting HTML it doesn't find the value property and has no JavaScript errors. How can I bind value
property of a textarea
to function.
Jsfiddle Demo
You can do it like this:
<textarea rows="5" type="text" data-bind="value: SetValue(firstName)" />
and than in javascript:
function AppModel() {
this.firstName = "ebram";
this.lastName = "Tharwat";
this.SetValue = function (data) {
//Do the processing over here
return data.toUpperCase();
}
}
ko.applyBindings(new AppModel());
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