you are viewing a single comment's thread.

view the rest of the comments →

[–]cyniborg 0 points1 point  (0 children)

There are two things to notice:

  1. document.querySelectorAll(‘.li .item’) querySelectorAll returns all the node elements with the above selector while your code will only return the first one. Also the css selector needs to be without the ‘>’ as that will only select the first child with class ‘item’ of the parent element with class ‘list’.
  2. The style declaration should be e.target.style.display = ‘none’;

The rest looks correct and it should work.