JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" placeholder="Type anything">

JavaScript

$('input').keypress(function(e) {
	if (e.key !== '1') return false;
});