JSFiddle - React, Tailwind, and code Playground

by salt

HTML

<input type="text" />

JavaScript

$("input").keypress(function(event) {
    var val=$(this).val();
    //if(val>=0){
      if ( event.which == 38) {
         $(this).val(val+1)
      }
      if ( event.which == 40) {
          $(this).val(val-1)
     // }
};    
})