Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

David Aguirre
8,170 PointsAfter refactoring my span element the name is not showing.
Here is my code
document.addEventListener('DOMContentLoaded' , () =>{ const form = document.getElementById('registrar') const input = form.querySelector('input') const divmain = document.querySelector('.main')
const ul = document.getElementById('invitedList') const div = document.createElement('div') const filterLabel = document.createElement('label') const filterCheckbox= document.createElement('input')
filterLabel.textContent = ' Show who has confirmed the invitation '; filterCheckbox.type = 'checkbox'
div.appendChild(filterLabel) div.appendChild(filterCheckbox)
divmain.insertBefore(div , ul)
filterCheckbox.addEventListener('change' , (e) =>{ const isChecked = e.target.checked const lis = ul.children
if (isChecked){
for(let i = 0 ; i < lis.length ; i +=1){
const li = lis[i]
if(li.className === 'responded'){
li.style.display = '';
} else { li.style.display = 'none'}}}
else { for(let i = 0 ; i < lis.length ; i +=1){
const li = lis[i]
li.style.display = '';}}})
function createLi(text){ function createElement(elementName , property , value) { const element = document.createElement('elementName') element[property] = value; return element } const li = document.createElement('li'); const span = createElement('span', 'texContent' , text)
li.appendChild(span)
const label = document.createElement('label')
label.textContent = 'Confirmed'
const checkbox = document.createElement('input')
checkbox.type = 'checkbox'
label.appendChild(checkbox)
li.appendChild(label)
const editButton = document.createElement('button')
editButton.textContent = 'edit'
li.appendChild(editButton)
const removeButton = document.createElement('button')
removeButton.textContent = 'remove'
li.appendChild(removeButton)
return li;}
form.addEventListener('submit' , (e) => { e.preventDefault();
const text =input.value
input.value = ''
const li = createLi(text) ul.appendChild(li)
})
1 Answer

KRIS NIKOLAISEN
54,668 PointsHere you are missing a t in textContent
const span = createElement('span', 'texContent' , text)
I also added semicolons throughout. Here is a snapshot with those changes and functional code.