Uncaught TypeError: Cannot read property 'nodeType' of undefined

Hello

Why do I receive it in the console: “Uncaught TypeError: Cannot read property ‘nodeType’ of undefined”

Code: http://jsfiddle.net/8Observer8/gQsrL/

Thank you in advance!

The attr method requires at least one argument, typically an attribute name.

1 Like

Thank you very much :slight_smile:


$( function() {
    $( "p#i_am_blue" ).attr( "class", "blue" );
    var attribute = $( "p#i_am_blue" ).attr( "class" );
    console.log( attribute );
} );