JSFiddle - React, Tailwind, and code Playground
HTML
<input id="test" type="text">
JavaScript
$('body').on('keydown', '#test', function(event) {
$(this).val('hi');
if(SOME_CONDITION) {
$('#test').unbind('on');
}
}).on('keyup', '#test', function(event) {
$(this).val('bye');
})