-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
31 lines (30 loc) · 849 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
24
25
26
27
28
29
30
31
$(document).ready(function () {
// variable declare and Set
let container = $("#container");
let form = document.getElementById("form");
let add = $("#add");
let submit = $("#submit");
let boss = $("#boss");
let follower = $(".follower");
// add inputs
add.click(() => {
container.append(
'<div><input type="tel" name="tel[]" placeholder="9876543210" /><button type="button" class="remove">Remove</button></div>'
);
});
// remove input
container.on("click", ".remove", () => {
$(this).parent("div").remove();
});
// values in console.log
submit.click((e) => {
e.preventDefault();
let fd = new FormData(form);
console.log(fd.getAll("tel[]"));
});
// value set on keyup
boss.keyup(() => {
let val = boss.val();
follower.text(val);
});
});