JSFiddle - React, Tailwind, and code Playground

by rupesx

HTML

<input type="text" value="" >
<p style="display:none">Accepting Only values 6 - 9</p>

JavaScript

var t = false

$('input').focus(function () {
    var $this = $(this)
    t = setInterval(

    function () {
        if (($this.val() < 6) && $this.val().length != 0) {
            $('p').fadeIn(300)
        }
    }, 10)
})
$('input').keyup(function(){
 if ($('input').val().length == 0) {
      $('p').fadeOut(300);
		}
});
$('input').blur(function () {
   if( !this.value ) {
           $('p').fadeOut(300);
    }
})