JSFiddle - React, Tailwind, and code Playground

HTML

<input type="submit" name="submit" value="Submit" onclick="CheckDecimal(text1)"/>

JavaScript

function CheckDecimal(inputtxt)   
{   
alert();
var decimal=  /^[-+]?[0-9]+\.[0-9]+$/;   
if(inputtxt.value.match(decimal))   
{   
alert('Correct, try another...')  
return true;  
}  
else  
{   
alert('Wrong...!')  
return false;  
}  
}