Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. 'use strict'
  2.  
  3.  
  4. //const b = document.getElementById("berry");
  5.  
  6. //console.log(b);
  7.  
  8. const c = document.querySelector('ul');
  9. c[4].style.backgroundColor = "red";
  10.  
  11. console.log(c[5]);
  12.  
  13.  
  14. const orange = c[2];
  15. orange.backgroundColor = "orange";
  16.  
  17. const HTMLcollection = document.getElementsByTagName('li');
  18. console.log(HTMLcollection);
  19.  
  20. for(let i = 0; HTMLcollection.length > i, i++;){
  21. let p = HTMLcollection[i].innerHTML;
  22. let v = HTMLcollection[i];
  23.  
  24. if( p === "Pear"){
  25. p.backgroundColor = "green";
  26. }
  27.  
  28. v.style.width = "100px";
  29. v.style.listStyle = "none";
  30. }
  31.  
  32. const all = document.querySelectorAll('li');
  33. console.log(all);
  34.  
  35. all.forEach(item) => {
  36. console.log(item);
  37. item.style.borderStyle = "dotted double";
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement