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

Welcome Julius
Welcome Julius
6,960 Points

am stack with this i need help

am stack with this i need help with this challenges task 2 and 3

app.js
var contentDiv = document.getElementById('content');
var newParagraph = .className= 'panel';
index.html
<!DOCTYPE html>
<html>
    <head>
        <title>DOM Manipulation</title>
    </head>
    <link rel="stylesheet" href="style.css" />
    <body>
        <div id="content">

        </div>
        <script src="app.js"></script>
    </body>
</html>

1 Answer

rabin
seal-mask
.a{fill-rule:evenodd;}techdegree
rabin
Front End Web Development Techdegree Student 15,247 Points

Hey Welcome Julius,

  1. You need to first create a new paragraph element using createElement method and store it in a newParagraph variable.
  2. In the second task, add a class name panel using className property.
  3. And finally, append newParagraph element to contentDiv.

Here's the final version of code for this challenge:

var contentDiv = document.getElementById('content');
var newParagraph = document.createElement('P');

newParagraph.className = "panel";
contentDiv.appendChild(newParagraph);

Hope this helps!