Syntax Error in innerHTML

<ul class="output ul"></ul>
    <script>
      const list = document.querySelector(".output ul");
      list.innerHTML = "";  // caught TypeError: Cannot set properties of null (setting 'innerHTML')
 
    </script>

sir , could you show me with the code .

What part of what I said do you not understand?

Currently, you are trying to target ul elements that are decedents of the class output. There are none. You can simply target the output class with your selector.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.