JSFiddle - React, Tailwind, and code Playground

by orlov0562

HTML

<input type="text" id="res" value="0" />
<div id="res_render">0</div>
<button id="dec">-1</button>
<button id="inc">+1</button>

CSS

input {display:none;}

JavaScript

$('#res').change(function(){
    $('#res_render').html(this.value);
    $('#res_render').css('font-size', 
				+this.value >= 3 ? '2em' : '1em'
    );
  });

  $('#dec').click(function(){
    $('#res').val(+$('#res').val() - 1);
    $('#res').trigger('change');
  });
  
  $('#inc').click(function(){
    $('#res').val(+$('#res').val() + 1);
    $('#res').trigger('change');
  });