const errors = document.getElementById('errors') const notify = (msg, level = 'ok') => { const p = document.createElement('p'); p.classList.add(level); const button = document.createElement('button'); button.innerText = 'X'; button.style.display = 'inline'; button.onclick = () => errors.removeChild(p); const span = document.createElement('span'); span.innerText = `${level != 'ok' ? `${level}: ` : ''}${msg}`; p.appendChild(button); p.appendChild(span); errors.appendChild(p); }