JavaScript for WordPress › Forums › Vanilla JavaScript › First attempt at innerHTML This topic has 3 replies, 2 voices, and was last updated 8 years, 5 months ago by Zac Gordon. Viewing 4 posts - 1 through 4 (of 4 total) Author Posts June 9, 2016 at 7:35 pm #6459 Jonathan ShymanParticipant I tried replicating the atom files you have and added in my own var and tried to log it out. I got undefined instead of the content, why is that? Here is the screenshot: https://drive.google.com/file/d/0B_UVfS1QFwg7V3hPaFNPMG5EMTA/view?usp=sharing June 9, 2016 at 9:28 pm #6471 Zac GordonKeymaster Hey Jon! The reason is that getElementsByTagName returns an array. Anything that has “elements” with the plural “s” returns an array, even if there is only one object in that array. So if you did this it would work: var jon = document.getElementsByTagName( 'h1' )[0]; Does that explain it? June 13, 2016 at 9:36 pm #7205 Jonathan ShymanParticipant yes, I believe I have it now! June 13, 2016 at 9:40 pm #7207 Zac GordonKeymaster Oh great 🙂 Just post back up if you have any questions!!! Author Posts Viewing 4 posts - 1 through 4 (of 4 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In