0

for my school project i am asked to use:
getElementById("id1").getElementsByClassName("class1").getElementsByTagName("h1");
However when I use this nothing hapens and in the console of the html page the following error occurs: document.getElementById(...).getElementsByClass is not a function
The Problem here is that whenever i delete that third one in line everything works fine.

If someone can help me than i would love to hear your solution.

Retr0
  • 1
  • 2
  • 1
    `document.querySelectorAll('#id1 .class1 h1')` https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll – Satpal Sep 23 '16 at 11:17
  • `getElementById("id1").getElementsByClassName("class1")` Yes. `getElementsByClassName("class1").getElementsByTagName("h1")` No. – T.J. Crowder Sep 23 '16 at 11:18

0 Answers0