jquery check if element has a class or another class code example Example: jquery hasclass $( "#mydiv" ).hasClass( "foo" )