-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
60 lines (35 loc) · 1.35 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
57
58
59
60
const listOfItem = [];
const input = document.getElementById('userInput');
const Inprogress = document.getElementById('taskINprogress')
const complete = document.getElementById('TaskComplete')
let index = 1
let contianerId = 'itemContainer'+index
function AddItem(){
const ItemContainer = document.createElement('div');
// set a class value for div to style it
const RadioButton = document.createElement('input');
const Item = document.createElement('label');
Item.appendChild(document.createTextNode(input.value));
Item.setAttribute("for" , index);
ItemContainer.setAttribute("id" , contianerId)
ItemContainer.setAttribute("class" , 'ItemContainer')
RadioButton.setAttribute('type' , 'checkbox' )
RadioButton.setAttribute('id' , index )
ItemContainer.appendChild(RadioButton)
ItemContainer.appendChild(Item)
Inprogress.appendChild(ItemContainer)
input.value = ''
index += 1
}
document.querySelector('button').addEventListener('click' , AddItem)
// Add event listener for "keydown" event
input.addEventListener("keydown", function(event) {
if (event.keyCode === 13) {
AddItem()
input.value = "";
}
});
function ToMovePrToCom(x){
const toManipultae = document.getElementById(x)
complete.appendChild(toManipultae)
}