I've seen this in JavaScript in numerous examples but I can't get this to work for me. I must be overlooking something, so I would appreciate a kind soul helping me out here because I am new to JavaScript:
spend=eval(form.spend.value);
if(isNaN(form.spend.value)) {
alert('I am not a number');
}
The above form input is gathered from:
<input type=text name=spend value="" size=6 STYLE="background-color: #EDEDE8;">
If I enter in abc as input, the alert I am not a number doesn't display. If I enter "abc" with quotes around is, it does display the alert.
I am checking input from the form where the user should only be allowed to enter numbers. Only numbers should be accepted. Thank you!
Edit: spend is US dollar amount. So it needs to be able to accept amounts such as 123.45. Edit2: Sorry, num is indeed form.spend.value.