This is driving me insane, can't for the life figure out what the issue is. Any help would be greatly appreciated!

constform=document.getElementById('registrar');constinput=form.querySelector('input');constmainDiv=form.querySelector('.main');constul=document.getElementById('invitedList');constdiv=document.createElement('div');constfilterLabel=document.createElement('label');constfilterCheckBox=document.createElement('input');filterLabel.textContent="Hide those who haven't responded";filterCheckBox.type='checkbox';div.appendChild(filterLabel);div.appendChild(filterCheckBox);mainDiv.insertBefore(div,ul);functioncreateLI(text){constli=document.createElement('li');constlabel=document.createElement('label');constcheckbox=document.createElement('input');constspan=document.createElement('span');consteditButton=document.createElement('button');constremoveButton=document.createElement('button');span.textContent=text;li.appendChild(span);label.textContent='Confirmed';checkbox.type='checkbox';label.appendChild(checkbox);li.appendChild(label);editButton.textContent='edit';li.appendChild(editButton);removeButton.textContent='remove';li.appendChild(removeButton);returnli;}form.addEventListener('submit',(e)=>{consttext=input.value;constli=createLI(text);e.preventDefault();input.value='';ul.appendChild(li);});ul.addEventListener('change',(e)=>{constcheckbox=event.target;constchecked=checkbox.checked;constlistItem=checkbox.parentNode.parentNode;if(checked){listItem.className='responded';}else{listItem.className=''}});ul.addEventListener('click',(e)=>{if(e.target.tagName==='BUTTON'){constbutton=e.target;constli=button.parentNode;constul=li.parentNode;if(button.textContent==='remove'){ul.removeChild(li);}elseif(button.textContent==='edit'){constspan=li.firstElementChild;constinput=document.createElement('input');input.type='text';input.value=span.textContent;li.insertBefore(input,span);li.removeChild(span);button.textContent='save';}elseif(button.textContent==='save'){constinput=li.firstElementChild;constspan=document.createElement('span');span.textContent=input.value;li.insertBefore(span,input);li.removeChild(input);button.textContent='save';}}});