-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcasing.html
36 lines (35 loc) · 1.14 KB
/
casing.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Tools - Casing</title>
<script src="components/sidebar-component.js"></script>
<script src="components/header-component.js"></script>
<link href="index.css" rel="stylesheet">
</head>
<body>
<header-component></header-component>
<sidebar-component></sidebar-component>
<main>
<textarea id="content"></textarea>
<select id="case-choice" title="case choice">
<option value="upper">To uppercase</option>
<option value="lower">To lowercase</option>
</select>
<code id="output"></code>
</main>
<script>
document.getElementById('content').addEventListener('keyup', changeCase);
document.getElementById('case-choice').addEventListener('change', changeCase);
function changeCase() {
const content = document.getElementById('content').value;
const caseChoice = document.getElementById('case-choice').value;
if (caseChoice === 'upper') {
document.getElementById('output').innerHTML = content.toUpperCase();
} else {
document.getElementById('output').innerHTML = content.toLowerCase();
}
}
</script>
</body>
</html>