-
Notifications
You must be signed in to change notification settings - Fork 26.8k
/
common-job-types.html
53 lines (47 loc) · 1.29 KB
/
common-job-types.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
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Common job types example</title>
<style>
html {
font-family: sans-serif;
}
div {
margin-bottom: 10px;
}
</style>
</head>
<body>
<h1>Common job types form </h1>
<form>
<div>
<label for="job">Job type:</label>
<select id="job" name="job">
<option value="">-- select job --</option>
<option value="butcher">Butcher</option>
<option value="baker">Baker</option>
<option value="candle">Candlestick maker</option>
<option value="other">Other</option>
</select>
</div>
<div>
<label for="other-job">Other job:</label>
<input type="text" name="other-job" id="other-job">
</div>
</form>
<script>
const select = document.querySelector('select');
const other = document.querySelector('input');
other.parentElement.style.display = 'none';
select.onchange = function() {
if(select.value === 'other') {
other.parentElement.style.display = 'block';
} else {
other.parentElement.style.display = 'none';
}
}
</script>
</body>
</html>