I'm trying to create an if statement that runs the code if the clicked li element doesn't have a class of photo.
$('div.menu li').click(function(){
    var content = $(this).attr('class');
    if (/* I can't figure out the correct syntax that goes here? */){
        $("div.content_wrapper, div.content").hide();
        $('div.content_wrapper').animate({width: 'toggle'});
        $('div.content_wrapper, div.' + content).show();
        $('div.menu li').removeClass('menuactive');
        $(this).addClass('menuactive');
    }
});
                if(!$(this).hasClass('className')) {
    // clicked element does not have the class
}
                        Just use jQuery's .is:
if(!$(this).is('.some-class')) { // ...
Or, if you so prefer, .hasClass:
if(!$(this).hasClass('some-class')) { // ...
                        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