خرید بک لینک

Vote count: 1

I'm trying to create a paragraph element with some text, but I think I'm appending the text before the paragraph element is added to the DOM. How can I fix this?

function myFn() {
  var paragraph = document.createElement("P");
  var text = document.createTextNode("This is some paragraph text.");

  paragraph.className = "heading";
  paragraph.style.width = "100vw";
  paragraph.style.background = "blue";
  document.getElementById("container").appendChild(paragraph);
  document.getElementById("heading").appendChild(text);
}

Pen: http://codepen.io/ourcore/pen/XdGRXN

Thanks!

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 22 ارديبهشت 1395 ساعت: 10:52

صفحه بندی