function newElement() {
    var li = document.createElement("li");
    var inputValue = document.getElementById("myInput").value;
    var t = document.createTextNode(inputValue);
    li.appendChild(t);
    if (inputValue === '') {
      alert("No to-do item added");
    } else {
      document.getElementById("To-Do-List").appendChild(li);
    }
    document.getElementById("myInput").value = "";
    var span = document.createElement("SPAN");
    var txt = document.createTextNode("Delete");
    span.className = "close";
    span.appendChild(txt);
    li.appendChild(span);

    for (i = 0; i < close.length; i++) {
      close[i].onclick = function() {
        var div = this.parentElement;
        div.style.display = "none";
      }
    }
  }
// Create a new list item when clicking on the "Add" button

Create a new list item when clicking on the "Add" button
Create a new list item when clicking on the " Add " button
function newElement() {
    var li = document.createElement("li");
    var inputValue = document.getElementById("myInput").value;
    var t = document.createTextNode(inputValue);
    li.appendChild(t);
    if (inputValue === '') {
      alert("No to-do item added");
    } else {
      document.getElementById("To-Do-List").appendChild(li);
    }
    document.getElementById("myInput").value = "";
    var span = document.createElement("SPAN");
    var txt = document.createTextNode("Delete");
    span.className = "close";
    span.appendChild(txt);
    li.appendChild(span);
    for (i = 0; i < close.length; i++) {
      close[i].onclick = function() {
        var div = this.parentElement;
        div.style.display = "none";
      }
    }
  }
function newElement ( ) { var li = document . createElement ( "li" ) ; var inputValue = document . getElementById ( "myInput" ) . value ; var t = document . createTextNode ( inputValue ) ; li . appendChild ( t ) ; if ( inputValue === '' ) { alert ( "No to-do item added" ) ; } else { document . getElementById ( "To-Do-List" ) . appendChild ( li ) ; } document . getElementById ( "myInput" ) . value = "" ; var span = document . createElement ( "SPAN" ) ; var txt = document . createTextNode ( "Delete" ) ; span . className = "close" ; span . appendChild ( txt ) ; li . appendChild ( span ) ; for ( i = 0 ; i < close . length ; i ++ ) { close [ i ] . onclick = function ( ) { var div = this . parentElement ; div . style . display = "none" ; } } }
Create a new list item when clicking on the "Add" button
Create a new list item when clicking on the " Add " button