I need users to enter an amount and this may come in different formats like 500 or 500.00. So I need to check if the user has entered a number or a number with two decimal points. SO far I have tried
if(/^\d+$/.test(amount) === false || /[0-9]+(\.[0-9][0-9]?)?/.test(amount) === false){
//valid
}else{
//invalid
}
But so far only the one to check if it is a number is working fine.
falses totrue.