Add error class

This commit is contained in:
2020-04-02 18:51:39 +02:00
parent a8b4c625ef
commit e8b8fbcd5c
4 changed files with 37 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ const noteForm = document.getElementById('noteInput');
const noteText = document.getElementById('noteInputText');
const noteSubmit = document.getElementById('noteInputSubmit');
const notes = document.getElementById('notes');
const error1 = document.getElementById('testError');
/* Add event listeners */
@@ -21,6 +22,13 @@ jQuery('button').click('click', buttonDelete);
function addNote(evt) {
evt.preventDefault();
if (noteText.value === '') {
error1.style.display = 'block';
return;
} else {
error1.style.display = 'none';
}
const text = noteText.value;
noteText.value = '';