-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
29 lines (25 loc) · 1.13 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
console.log("welcome to the control kitty");
// var i=3;
// let addBtn = document.getElementById('addBtn');
// addBtn.addEventListener("click", (e)=> {
// e.preventDefault();
// console.log("You clicked the add new person");
// let addNew = document.getElementById("New").innerHTML=`<div class="form-group"><label for="exampleFormControlInput1">Person ${i}</label>
// <input type="text" class="form-control" id="exampleFormControlInput1" name="Person${i}" placeholder="Jill" required></div>`;
// i++;
// });
let addBtn = document.getElementById('addBtn');
var i=3;
addBtn.addEventListener("click", (e)=> {
e.preventDefault();
console.log("You clicked the add new person");
// let addNew = document.getElementById("addNew");
var tag = document.createElement("div");
tag.innerHTML=`<div class="form-group">
<label for="exampleFormControlInput1">Person ${i}</label>
<input type="text" class="form-control" name="Person${i}" id="exampleFormControlInput1" placeholder="Jill">
</div>`;
var element = document.getElementById("New");
element.appendChild(tag);
i++;
});