Example taken from the documentation and stuck to a fiddle doesn't work. Code snippet for completeness:
<p>Login name: <input data-bind="textInput: userName" /></p>
<p>Password: <input type="password" data-bind="textInput: userPassword" /></p>
ViewModel:
<pre data-bind="text: ko.toJSON($root, null, 2)"></pre>
<script>
ko.applyBindings({
userName: ko.observable(""), // Initially blank
userPassword: ko.observable("abc") // Prepopulate
});
</script>
I've tried it in an incognito window thinking that some browser extension might be messing with it. No luck.
Expected behavior is that viewModels's JSON dump should be updated with each keystroke in any of the input fields change.
If I switch to value binding instead of textInput it does update whenever input focus changes.
Has anyone encountered this?