Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
41
rated 0 times [  45] [ 4]  / answers: 1 / hits: 29663  / 14 Years ago, wed, april 28, 2010, 12:00:00

Is this the notation to use for Not Equal To in JS, in jquery code



!== OR != 


None of them work



Here is the code I am using



var val = $('#xxx').val();
if (val!='') {
alert(jello);
}


Thanks
Jean


More From » jquery

 Answers
180

Equality testing in JQuery works no different from standard JavaScript.



!= means not equal to, but !== makes sure that both values have the same type as well. As an example, 1 == '1' is true but not 1 === '1', because the LHS value is a number and the RHS value is a string.



Given your example, we cannot really tell you a lot about what is going on. We need a real example.


[#96942] Monday, April 26, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jaredsages

Total Points: 273
Total Questions: 97
Total Answers: 105

Location: French Southern and Antarctic Lands
Member since Fri, Jan 6, 2023
1 Year ago
jaredsages questions
;