-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
58 lines (48 loc) · 1.71 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🦄 Tab Component 🦄</title>
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="pretty-styles.css">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet">
</head>
<body>
<div class="tab-wrapper">
<div id="tabs">
<img class="unicorn" src="unicorn-head-silhouette.svg">
</div>
</div>
<form id="form" method="post">
<label>
Tab Button Name<br>
<input name="tabButton" type="text" id="newTabButton" required>
</label>
<label>
Tab Title<br>
<input name="tabTitle" type="text" id="newTabTitle">
</label>
<label>
Tab Content<br>
<textarea name="tabText" id="newTabText" rows="4" cols="16" required></textarea>
</label>
<button type="submit">Submit</button>
</form>
<script src="tab-component.js"></script>
<script>
let unicornTabs = new UnicornTabs();
function newTabFormData(e) {
e.preventDefault();
let newTabButtonValue = document.getElementById('newTabButton').value;
let newTabTitleValue = document.getElementById('newTabTitle').value;
let newTabTextValue = document.getElementById('newTabText').value;
var addNewTab = {"tabButton":newTabButtonValue, "tabTitle":newTabTitleValue, "tabText":newTabTextValue}
tabData.push(addNewTab);
unicornTabs.newTab();
alert("New tab have been added");
}
form.addEventListener('submit', newTabFormData);
</script>
</body>
</html>