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

does not show up on for the manipulating the dom

what am i doing wrong. I've done what the example shows and it still isn't showing up in the console.

const form = document.getElementById('registrar');
  const input = form.querySelector('input');
form.addEventListener('submit',(e) => {
  e.preventDefault();
 console.log(input.value); 
}

console/network screenshot

x

7 Answers

that was it. they don't have the app.js file linked in the html page.

okay , so i investigated the html page and it seems that it does not come with the link to the javascript file. i'm going to try and hook that up and see if it works then .

Benjamin Larson
Benjamin Larson
34,055 Points

Looks like you maybe forgot to close the addEventListener function with a closing parenthesis and semi-colon?

const form = document.getElementById('registrar'); 
const input = form.querySelector('input'); 
form.addEventListener('submit',(e) => { 
    e.preventDefault(); 
    console.log(input.value); 
});

oh yeah, no..i'm sorry that is the fault of my . bad copy and pasting effort. they are actually already closed properly..

Benjamin Larson
Benjamin Larson
34,055 Points

I see you added a screenshot there but it's not displaying. Does anything happen in the console when you hit the submit button? I copied and pasted your code into my Workspace and it worked fine.

nothing happens in the console. I tried using the debugger in the dev tools and its not showing as anything being wrong. let me try and upload my screen shot again. example link That should link you to my screen shot of the http responses I was getting back

Benjamin Larson
Benjamin Larson
34,055 Points

It does seem odd. Unless someone else has insight, I'd probably need to fork the workspace to see what's going on.

thanks, and thank you for also being confused because it helps to know that i'm not truly not going insane.

delete the text/javascript type in the <script> element.