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

@@ -22,6 +22,13 @@
</div> </div>
<div id="notes" class="textboxGrid"></div> <div id="notes" class="textboxGrid"></div>
<div class="error" id="testError">
<b>ERROR:</b>
Please insert something in the textarea
</div>
</div> </div>
</body> </body>

View File

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

View File

@@ -211,3 +211,14 @@ tr:hover {
.inlineTable tr th, .inlineTable tr td { .inlineTable tr th, .inlineTable tr td {
display: table-cell; display: table-cell;
} }
.error {
display: none;
border: 1px solid black;
border-radius: 5px;
background-color: #f92677;
width: 20%;
padding: 10px;
text-align: center;
margin: 15px auto;
}

View File

@@ -105,4 +105,15 @@
} }
} }
}
.error {
display: none;
border: 1px solid black;
border-radius: 5px;
background-color: $red;
width: 20%;
padding: 10px;
text-align: center;
margin: $standardMargin auto;
} }