jQuery check if attr = value

attr, conditional-statements, if-statement, jquery

Solution

Just remove the .val(). Like:

if ( $('html').attr('lang') == 'fr-FR' ) {
    // do this
} else {
    // do that
}

Problem

I seem to be having trouble with my code. I need to say: ``` if ( $('html').attr('lang').val() == 'fr-FR' ) { // do this } else { // do that } ``` When I check the console, I just get an error telling me this isn't a function. Help would be appreciated. Thanks,

Original source