What you have is correct, you just want to add valueUpdate: 'afterkeydown'
to your bindings so they update as you type.
<input type="text" data-bind="value: theValue, valueUpdate: 'afterkeydown'" />
<br />
<input type="text" data-bind="value: theValue, valueUpdate: 'afterkeydown'" />
Also, ko.applyBindings(new ViewModel());
should be ko.applyBindings(viewModel);
Here's a full demo