-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
23 lines (19 loc) · 845 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var i =1;
function app() {
document.getElementById('li').innerHTML=`<input type="text" id="liinput" name="in"> <button name="add" onclick=add()>add</button> <button name="dull" onclick=dull()>dull</button><br>`;
li.removeAttribute('hidden')
}
function add() {
let temp = document.getElementById(`liinput`).value;
let need= temp;
document.getElementById(`do`).innerHTML+=`<div id="spanli${i}"><span>${need}</span> <button name="remove" onclick=remove(${i}) id="rem${i}">remove</button></div>`;
i++
}
function remove(i) {
let spanli=document.getElementById(`spanli${i}`)
spanli.setAttribute('hidden', 'true')
}
function dull(){
let li=document.getElementById(`li`)
li.setAttribute('hidden', 'true')
}