Advertisement
IzdiharTEAM17

main-source

Feb 25th, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var post = [
  2.   {
  3.     type: "plain",
  4.     content: {
  5.       title: "Main",
  6.       description: "Maybe this is work?"
  7.     }
  8.   }
  9. ];
  10.  
  11. function newpost(id) {
  12.   var type = post[id].type;
  13.   var content = post[id].content;
  14.  
  15.   if (type == "plain") {
  16.     var new_post = document.createElement("DIV");
  17.     new_post.setAttribute("class","post type-plain");
  18.     document.getElementsByClassName("workspace")[0].appendChild(new_post);
  19.  
  20.     var pcontent1 = document.createElement("H3");
  21.     pcontent1.innerHTML = content.title;
  22.     new_post.appendChild(pcontent1);
  23.  
  24.     var pcontent2 = document.createElement("P");
  25.     pcontent2.innerHTML = content.description;
  26.     new_post.appendChild(pcontent2);
  27.   }
  28. }
  29.  
  30. newpost(0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement