You’re assigning with =
. Use ==
or ===
.
if( 0 == number ){
text.value = "You didn't enter a number!";
}
Also, be wary of your brace placement. Javascript likes to automatically add semicolons to the end of lines. Source.
More Related Contents:
- Javascript if statement says 63>542 is true
- Else statement does not work
- Why does my program not work
- javascript “if” statement returning false value when both values are equal
- Javascript if-else statement not working [duplicate]
- Alternative to a million IF statements
- How do I test if a variable does not equal either of two values?
- Check if a value is within a range of numbers
- How to write an inline IF statement in JavaScript?
- Is && statement() the same as if() statement()?
- Which Logic Operator Takes Precedence
- Do ‘if’ statements in JavaScript require curly braces? [duplicate]
- JavaScript if “x = (a || b || c)” statement not working
- “elseif” syntax in JavaScript
- How to shorten my conditional statements
- javascript variable scope in the IF statement
- JavaScript shorthand if statement, without the else portion
- JavaScript conditional switch statement
- How to use OR condition in a JavaScript IF statement?
- JavaScript single line ‘if’ statement – best syntax, this alternative? [closed]
- How to specify multiple conditions in an ‘if’ statement in JavaScript [closed]
- Why javascript treats 0 equal to empty string? [duplicate]
- How to negate code in “if” statement block in JavaScript -JQuery like ‘if not then..’
- jQuery – how to check if an element exists?
- Unnecessary ‘else’ after ‘return’. (No-else-return)
- How do I test for NaN? [duplicate]
- how to compare two strings in javascript if condition
- Using Javascript to compare two input numbers in HTML?
- Shorthand for if-else statement
- Angularjs – simple form submit