-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
29 lines (25 loc) · 967 Bytes
/
script.js
File metadata and controls
29 lines (25 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function createNote() {
const stickyNotes = document.querySelector('.sticky-notes');
const noteContainer = document.createElement('div');
noteContainer.classList.add('note-container');
const noteContent = document.createElement('div');
noteContent.classList.add('note-content');
noteContent.contentEditable = true;
noteContent.textContent = 'New note';
const noteActions = document.createElement('div');
noteActions.classList.add('note-actions');
const deleteButton = document.createElement('button');
deleteButton.classList.add('delete-note');
deleteButton.textContent = 'Delete';
deleteButton.onclick = function () {
noteContainer.remove();
};
noteActions.appendChild(deleteButton);
noteContainer.appendChild(noteContent);
noteContainer.appendChild(noteActions);
stickyNotes.appendChild(noteContainer);
}
function deleteNote(button) {
const noteContainer = button.closest('.note-container');
noteContainer.remove();
}