-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
56 lines (42 loc) · 1.42 KB
/
script.js
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const input=document.getElementById('input')
const close=document.getElementById('close')
const board=document.getElementById('board')
const addnote=document.getElementById('addnote')
const create=document.getElementById('create')
addnote.addEventListener('click',function(){
board.style.display='block'
})
close.addEventListener('click',function(){
board.style.display='none'
input.value=''
})
create.addEventListener('click',function(){
const newnote=document.createElement('div')
newnote.className='note newnote'
noteapp.appendChild(newnote)
const notevalue=input.value
newnote.textContent=notevalue
console.log(notevalue)
const newbutton =document.createElement('div')
newbutton.className='newb'
const editor=document.createElement('button')
editor.textContent='edit'
editor.className='bt'
const deleter=document.createElement('button')
deleter.textContent='delete'
deleter.className='bt'
newbutton.appendChild(editor)
newbutton.appendChild(deleter)
newnote.appendChild(newbutton)
deleter.addEventListener('click',function(){
newnote.remove()
})
editor.addEventListener('click',function(){
newnote.remove()
board.style.display='block'
create.textContent='save'
input.value=notevalue
})
input.value=''
board.style.display='none'
})