What code can I use to throw an error when a user enters in incorrect data?
Just like when a user does not enter in data for a required field, I would like to make it so they have to make a certain field contain certain values.
If they enter a decimal value for price, how would I be able to prevent them from submitting?
if (input.indexOf(".") !== -1){
alert("You can't have decimal values");
}
Thank you.