JSFiddle - React, Tailwind, and code Playground

HTML

The following number <input type="text" class="answer" id="answer5" /> is ...

CSS

input[type="text"]{  
  width : 12px;
  border: none;
  background: transparent;
  font-size: 20px;
  color: #000;
  padding: 5px;
  font-weight: bold;
}

JavaScript

$( ".answer" ).keypress(function() {
	this.style.width = ((this.value.length + 1) * 12) + 'px';
})