Home › Forums › JavaScript › Dumbfounded by THIS › Reply To: Dumbfounded by THIS
September 3, 2013 at 1:49 pm
#148957
Member
Here’s how I would write it out: http://jsfiddle.net/33sZG/3/
The reason why it was always returning as ‘Red’ was because you’re using the same class selector.
$('.color').hasClass('red');
That will always return true because there is a div with a class of color
that also has a class of red
.