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 RSVP Checkbox

Keno Aguiar
Keno Aguiar
4,741 Points

Checkbox looks different

For some odd reason, my check box is not under the guest's name like shown in the video. The text is basically the same as the text of the guest's name. I didn't touch any of the css or html in the file.

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

form.addEventListener('submit', (e) => { e.preventDefault(); const text = nameInput.value; nameInput.value = ''; const ul = document.getElementById('invitedList'); let li = document.createElement('li'); li.textContent = text; const lable = document.createElement('lable'); lable.textContent = ' Confirmed'; const checkbox = document.createElement('input'); checkbox.type = 'checkbox'; lable.appendChild(checkbox); li.appendChild(lable); ul.appendChild(li); });

It is very difficult to see what is going on with your code when it is not formatted properly. Please be sure to use the markdown reference located under the comment box if you are unsure how to format your JavaScript.

I also noticed the word "label" is misspelled in your code as "lable". If this is supposed to reference anything labeled "label" in either the HTML or CSS, this may be your problem.

1 Answer

Hadi Khalili
Hadi Khalili
7,969 Points

Amber is correct. You have spelled label wrong. label is a html element while lable is not, that is why it is not created at all.