-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
74 lines (69 loc) · 3.09 KB
/
index.html
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Add Remove</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
</head>
<body>
<section class="py-5 bg-gradient">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-6">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody id="addID">
<tr>
<th scope="row">#</th>
<td>Markos</td>
<td>Ottoz</td>
<td>Odo</td>
<td>
<button type="button" class="btn btn-sm btn-danger remove-button">
Remove
</button>
</td>
</tr>
</tbody>
</table>
<div>
<button type="button" class="btn btn-primary btn-sm me-1" id="addButton">
Add
</button>
</div>
</div>
</div>
</div>
</div>
</section>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2" crossorigin="anonymous"></script>
<script>
$(document).on('click', '#addButton', function () {
var tr = '';
tr += '<tr>';
tr += '<th scope="row">#</th>';
tr += '<td>Markos</td>';
tr += '<td>Ottoz</td>';
tr += '<td>Odo</td>';
tr += '<td><button type="button" class="btn btn-sm btn-danger remove-button">Remove</button></td>';
tr += '</tr>';
$('#addID').append(tr);
});
// Remove Button
$(document).on('click', '.remove-button', function () {
$(this).closest('tr').remove();
});
</script>
</body>
</html>