Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (35 sloc) 1.58 KB

#jQuery Overview For instructions on how to run the tests, check the following link:

##Task 1 Create a function that takes a selector and COUNT, then generates inside a UL with COUNT LIs:

  • The UL must have a class items-list
  • Each of the LIs must:
    • have a class list-item
    • content "List item #INDEX"
      • The indices are zero-based
  • If the provided selector does not selects anything, do nothing
  • Throws if
    • COUNT is a Number, but is less than 1
    • COUNT is missing, or not convertible to Number
      • Example:
        • Valid COUNT values:
          • 1, 2, 3, '1', '4', '1123'
        • Invalid COUNT values:
          • '123px' 'John', {}, []

##Task 2 Create a function that takes a selector and:

  • 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 ID is not a jQuery object or a string
  • Use jQuery!
You can’t perform that action at this time.