Guest User

Untitled

a guest
Jun 22nd, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2. * Main
  3. */
  4.  
  5. addNewItem('The emptiness ...');
  6. addNewItem('The grace ...');
  7.  
  8. var btnShow = document.getElementById('btn-show');
  9. btnShow.onclick = showList;
  10.  
  11. var btnHide = document.getElementById('btn-hide');
  12. btnHide.onclick = hideList;
  13.  
  14. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  15. * Functions
  16. */
  17.  
  18. function addNewItem(text) {
  19. var newItem = document.createElement('a');
  20. newItem.href = '#';
  21. newItem.innerHTML = text;
  22.  
  23. var theList = document.getElementById('the-list');
  24. theList.appendChild(newItem);
  25. }
  26.  
  27. function showList(event) {
  28. var theList = document.getElementById('the-list');
  29. theList.className = 'dropdown-list shown';
  30. }
  31.  
  32. function hideList(event) {
  33. var theList = document.getElementById('the-list');
  34. theList.className = 'dropdown-list hidden';
  35. }
Add Comment
Please, Sign In to add comment