-
Notifications
You must be signed in to change notification settings - Fork 0
/
todoprogram.js
42 lines (28 loc) · 1.05 KB
/
todoprogram.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
function listing() {
var input = document.getElementById("in").value;
var rem = document.createElement("input");
rem.setAttribute("type", "button");
rem.setAttribute("value", "Remove");
rem.setAttribute("class", "remove");
rem.onclick = function () {
document.body.removeChild(list)
};
var edit = document.createElement("input");
edit.setAttribute("type", "button");
edit.setAttribute("value", "Edit");
edit.setAttribute("class", "edit");
edit.onclick = function () {
var change = document.getElementById("add").value = "save"
document.getElementById("in").value = list.innerText;
};
var change = document.getElementById("add").value = "add"
var olist = document.createElement("ol");
var list = document.createElement("li");
list.setAttribute("id", "lis");
list.innerText = input;
var list1 = olist.appendChild(list);
list.appendChild(edit);
list.appendChild(rem);
document.body.appendChild(list1);
document.getElementById("in").value = null;
}