Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery - how to write 'if not equal to' (opposite of ==)

Tags:

jquery

I need to reverse of the following code. How can I make the animation run if the width is NOT 500px.

$(".image-div").not(this).each(function() {         if ($(this).css('width') == '500px') {             $(this).animate({                     width: '250px'                 }, 500, function() {                 // Animation complete.             });         }       }); 

In other words, what the opposite of this?: ==

Thanks

like image 372
Evanss Avatar asked Jun 30 '11 18:06

Evanss


People also ask

What does != Mean in jQuery?

22.6k4 58 91. 41. == => != === => !== Equal and its opposite.

What is the opposite of ==?

The equal-to operator ( == ) returns true if both operands have the same value; otherwise, it returns false . The not-equal-to operator ( != ) returns true if the operands don't have the same value; otherwise, it returns false .

Is not condition in jQuery?

jQuery not() Method: This method returns elements that do not match a defined condition. This method specifies a condition. Elements that do not match the condition are returned, and those that match will be removed. Mostly this method is used to remove one or more than one elements from a group of selected elements.


1 Answers

The opposite of the == compare operator is !=.

like image 182
FishBasketGordo Avatar answered Sep 22 '22 01:09

FishBasketGordo