Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Loops, Arrays and Objects Tracking Multiple Items with Arrays Build a Quiz Challenge, Part 2

Hanna Zeif
Hanna Zeif
11,309 Points

getElementById Doesn't work

I launched the new workspace and used the code that came with it. Edited exactly as in the video and it didn't work. Any idea what could be wrong?

function print(message) { var outputDiv = document.getElementById('output'); outputDiv.innerHTML = message; }

1 Answer

Call the function at the end.

function print(message) { var outputDiv = document.getElementById('output'); outputDiv.innerHTML = message; }

function print('Some Message');