Paradoxis
Paradoxis

Reputation: 4708

Form validation returns reference error

I've made a form and a calculator that are supposed to place a simple order on a website. I'm trying to make it so that if the value is less than 1 you get an error on submitting, but for some reason this wont work.

I think it has something to do with <1 but i'm not sure.

This is my code:

if  (ATotal == <1){
    document.getElementById("Error").innerHTML = "Please specify an amount.";
    setTimeout("ErrorClear()",5000);
    return false;
}

Upvotes: 0

Views: 38

Answers (1)

FBHY
FBHY

Reputation: 1004

Yep, == <1 is wrong. Maybe you want

ATotal == 1

or

ATotal <= 1

Upvotes: 3

Related Questions