showing results for - "additem 28item 29 js"
Angela
24 May 2016
1function addItem(){
2    var ul = document.getElementById("dynamic-list");
3    var candidate = document.getElementById("candidate");
4    var li = document.createElement("li");
5    li.setAttribute('id',candidate.value);
6    li.appendChild(document.createTextNode(candidate.value));
7    ul.appendChild(li);
8}
9
10function removeItem(){
11    var ul = document.getElementById("dynamic-list");
12    var candidate = document.getElementById("candidate");
13    var item = document.getElementById(candidate.value);
14    ul.removeChild(item);
15}