const button = document.getElementById("addbtn") const notes = document.getElementById("notes") const msg = document.getElementById("msg") let idnum = 1 button.addEventListener("click", ()=>{ let inphead = document.getElementById("inphead") let inptext = document.getElementById("inptext") console.log(inphead.value); if (inphead.value != "" && inptext.value != ""){ let newnote = document.createElement("div") newnote.innerHTML = `
${inptext.value}
` newnote.classList.add("notescss") newnote.setAttribute("id", `note-${idnum++}`) newnote.setAttribute("title", "Kattintásra törölheted a jegyzetedet...") newnote.style.background = document.getElementById("notecolor").value notes.appendChild(newnote) msg.innerHTML = "" msg.innerHTML = "Üzenet hozzáadva!" inphead.value = "" inptext.value = "" newnote.onclick = function(){ // this.parentElement.removeChild(this) } notes.appendChild(newnote) msg.innerHTML = 'Üzenet hozzáadva!Töltsd ki a hiányzó mezőket!