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 DOM Scripting By Example Adding and Removing Names Registering Names

Diego Palma
Diego Palma
12,653 Points

I'm getting the following error in the console (my code is exactly the same as the one in the video)

app.js:2 Uncaught TypeError: Cannot read property 'querySelector' of null at app.js:2

const form = document.getElementById('registar');
const input = form.querySelector('input');

form.addEventListener('submit', (e) => {
  console.log(input.value);
});

2 Answers

Guil Hernandez
STAFF
Guil Hernandez
Treehouse Teacher

Hey Diego Palma,

It looks like you're missing an r in .getElementById('registrar'). :)

HIDAYATULLAH ARGHANDABI
HIDAYATULLAH ARGHANDABI
21,058 Points

Sir I get the li tag empty when i read it to the console

typos are treacherous...