Guest User

Untitled

a guest
Jul 23rd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. var div = document.createElement("div");
  2. div.style.width = "100px";
  3. div.style.height = "100px";
  4. div.style.background = "red";
  5. div.style.color = "white";
  6. div.innerHTML = "Hello";
  7.  
  8. document.body.appendChild(div);
  9.  
  10. var div = document.createElement('div');
  11. div.innerHTML = "my <b>new</b> skill - <large>DOM maniuplation!</large>";
  12. // set style
  13. div.style.color = 'red';
  14. // better to use CSS though - just set class
  15. div.setAttribute('class', 'myclass'); // and make sure myclass has some styles in css
  16. document.body.appendChild(div);
  17.  
  18. $('body')
  19. .append('my DOM manupulation skills dont seem like a big deal when using jquery')
  20. .css('color', 'red').addClass('myclass');
Add Comment
Please, Sign In to add comment