Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

#DOM Operations For instructions on how to run the tests, check the following link: https://github.com/TelerikAcademy/JavaScript-UI-and-DOM/blob/master/README.md#user-content-preparing-the-local-machine-for-unit-testing-with-mocha-and-chai

##Task 1 Create a function that takes an id or DOM element and:

  • If an id is provided, select the element
  • Finds all elements with class button or content within the provided element
    • Change the content of all .button elements with "hide"
  • When a .button is clicked:
    • Find the topmost .content element, that is before another .button and:
      • If the .content is visible:
        • Hide the .content
        • Change the content of the .button to "show"
      • If the .content is hidden:
        • Show the .content
        • Change the content of the .button to "hide"
      • If there isn't a .content element after the clicked .button and before other .button, do nothing
  • Throws if:
    • The provided DOM element is non-existant
    • The id is either not a string or does not select any DOM element