JavaScript for WordPress › Forums › Vanilla JavaScript › why use query selector › Reply To: why use query selector
June 14, 2016 at 1:24 pm
#7255
Jonathan Shyman
Participant
Thanks for your help!
Do you mean that I should just declare them and leave them empty until I assign them later, like this…?
var jon1, jon2, jon3;
var jon1 = document.getElementsByClassName("content")[0];
var jon2 = jon1.getElementsByTagName("article")[0];
var jon3 = jon2.getElementsByTagName("a")[0];
console.log (jon3.innerHTML);