JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<form data-bind="submit: show">
<input type="text" data-bind="value: someText" />
</form>
<script type="text/javascript">
var ViewModel = function () {
var self = this;
self.someText = ko.observable('initial value');
self.show = function () {
alert(self.someText());
self.someText('');
}
}
ko.applyBindings(new ViewModel());
</script>
</body>