Currently I have some code that reads
if ( $(this).hasClass('.someclass') )
{ }
else {
//Do Stuff here.
}
I know this isn't exactly kosher, but it works.
What's the proper way to go about this? How do I check for the abscence of a class?
Invert the test:
if (!$(this).hasClass('someclass'))
I think also that the .
should not be in front of the class name. See the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With