I would like to use placeholder attribute using data-bind
but I have a error message([object object]) . Please let me know how can I use it.
html:
JavaScript
x
3
1
input id="comments" class="form-control"
2
data-bind="attr: { placeholder: { locale: 'placeholder.comments', auth: false } }"
3
json:
JavaScript
1
4
1
"placeholder": {
2
"comments": "Tell us..."
3
}
4
Advertisement
Answer
The placeholder attribute should be a string (ko.observable), not an object.
JavaScript
1
2
1
<input data-bind="attr:{placeholder:hintText}" />
2
Simple example: http://jsfiddle.net/xtdL7om1/