JSFiddle - React, Tailwind, and code Playground

by bryiantan

HTML

<input type="text" id='txtQty'>

JavaScript

var tempPhone = '';
  $("#txtQty").keyup(function (e) {
 
    if($(this).val().match(/^\+?\d+$/))
    {
       tempPhone =  $(this).val();
   		 $(this).val( tempPhone);
    }
    else {
        $(this).val( tempPhone);
    }
	});