JSFiddle - React, Tailwind, and code Playground

HTML

<input id="foo" value="" type="text" />
<input id="bar" type="button" value="test" />
<div id="res">

</div>

JavaScript

reg=/^(1((8|9)|00))|[2-9]\d$/;
$(function(){
$('#bar').on('click', function(){
age= $('#foo').val();

rep = age.match(reg)? 'OK': 'KO';
$('#res').html( rep );
})
})