I've created a code on where i can try out javascript's conditions and the code goes like this: the user enter's a decimal number and an alert box will say that it is a decimal number.If it is not a decimal number, an alert box will pop up and say that it is not a decimal number. However, the problem is I don't know what to put in my IF conditional statement to identify if its decimal.
Here is my code:
var a = document.getElementById("txt1").value;
if (a == ?){
alert("It is a decimal number!");
} else {
alert("It is not a decimal number!");
}
I hope someone can help me out. A total beginner. Thanks!