JavaScript JavaScript and the DOM Making Changes to the DOM DOM Manipulation

Obe Juarez
Obe Juarez
5,903 Points

className is not it?

Its asking me to set the class name for my new class and it doesnt work. but its right isnt it?

var contentDiv = document.getElementById('content');
var newParagraph = document.createElement('p');
<!DOCTYPE html>
        <title>DOM Manipulation</title>
    <link rel="stylesheet" href="style.css" />
        <div id="content">

        <script src="app.js"></script>

1 Answer

Clayton Perszyk
Clayton Perszyk
Treehouse Moderator 46,595 Points

className is a property not a method, so need to assign value to it:

newParagraph.className = 'panel' // Do NOT add period
Obe Juarez
Obe Juarez
5,903 Points

Thank you!!!!