-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathmodule_revealing.html
More file actions
34 lines (30 loc) · 1.04 KB
/
Copy pathmodule_revealing.html
File metadata and controls
34 lines (30 loc) · 1.04 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Interactive HTML Example - Revealing Module Pattern</title>
</head>
<body>
<h1>Interactive HTML Example - Revealing Module Pattern</h1>
<label for="name-input">Enter Name:</label>
<input type="text" id="name-input">
<button id="set-name">Set Name</button>
<button id="get-name">Get Name</button>
<script type="module">
import myRevealingModule from './modules/myRevealingModule.mjs';
myRevealingModule.setName('Matt Gaunt');
// UI elements
const setNameButton = document.getElementById('set-name');
const getNameButton = document.getElementById('get-name');
const nameInput = document.getElementById('name-input');
setNameButton.addEventListener('click', () => {
const newName = nameInput.value;
myRevealingModule.setName(newName);
});
getNameButton.addEventListener('click', () => {
myRevealingModule.getName();
});
</script>
</body>
</html>