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

Do a pure JS Code about input element for a listen even

01 const input = document.getElementById('todo-input');
02
03 input.addEventListener('keyup', event => {
04   if (event.keyCode === 13 && event.target.value !== '')  {
05  
06  }
07  });

On a main.js ,I wrote 7 lines for something, but showing wrong ,how can I know what' wrong ?I am using dreamwaver CS6

1 Answer

Steven Parker
Steven Parker
229,981 Points

There does not appear to be anything wrong with this code, but it's lacking any content in the function body so it won't do anything noticeable as-is. It also depends on the HTML component, and since that part is not shown here it's still possible to have an issue there.

But if I add some appropriate HTML and some code for the function, this performs exactly as I would expect.