Jquery to test if $(this) does not have a specific class
jquery
Solution
You can use `not logical operator`, Try this:
if (!$(this).hasClass('white')) {console.log('not white');};
Returns false if its single operand can be converted to true; otherwise, returns true.
Problem
``` if ($(this).hasClass('white')) {console.log('white');}; ``` equates to true and prints to the console. How do I test if it does not have the class `white` on the $(this) selector? I have ``` if ($('this:not(.white)')) {console.log('not white');}; and if ($(this).not('.white')) {console.log('not white');}; and several other combinations? ``` I know I likely should use the .not() method, and can't figure out how to use the :not selector in combination with the `$(this)` selector. I would like that when the element is clicked, that I can see one true and one false statement. (it either does or doesn't have the class 'white')