Code not working

window.onload = function(){
let newtask = document.getElementById(‘newtask’)
let addtask = document.getElementById(‘addtask’)
let todolist = document.getElementById(‘todolist’)

addtask.onclick =function(){
    let li = documnet.createElement('li')
    li.innerText = newtask.value
    todolist.appendChild(li)
} 

}

Hi @ravip413131,
in the line 7 you have written “let li = documnet.createElement('li')” please see for the spelling of the word “DOCUMENT”, rest looks fine.

Please find below code for your reference:

`window.onload = function () {
      let newtask = document.getElementById("newtask");
      let addtask = document.getElementById("addtask");
      let todolist = document.getElementById("todolist");

      addtask.onclick = function () {
        let li = document.createElement("li");
        li.innerText = newtask.value;
        let xbtn = document.createElement("button");
        xbtn.innerText = "X";
        xbtn.onclick = function (event) {
          event.target.parentElement.remove();
        };
        li.appendChild(xbtn);
        todolist.appendChild(li);
      };
    };
    `

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.