var the_heading = document.getElementById("heading"), the_ul = document.getElementById("list"), the_button = document.getElementById("button"), the_li = document.getElementById("list").getElementsByTagName("li"), counter = 1; /*the_li[0].addEventListener("click" , function(){ the_heading.innerHTML = the_li[0].innerHTML; });*/ for (let i = 0; i < the_li.length; i++) { the_li[i].addEventListener("click" , ahmad) function ahmad () { the_heading.innerHTML = the_li[i].innerHTML; }; }; the_button.onclick = function () { the_ul.innerHTML = the_ul.innerHTML + "