-
Notifications
You must be signed in to change notification settings - Fork 0
/
hideInputs.js
43 lines (40 loc) · 2.47 KB
/
hideInputs.js
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
<script>
function refreshInputs(index) {
document.getElementById("text1").style.visibility = 'hidden';
document.getElementById("text2").style.visibility = 'hidden';
document.getElementById("text3").style.visibility = 'hidden';
if(index == 0)
document.getElementById("text1").style.visibility = 'visible';
if(index == 1)
document.getElementById("text2").style.visibility = 'visible';
if(index == 2)
document.getElementById("text3").style.visibility = 'visible';
}
</script>
<select id="selectOption" onChange="refreshInputs(this.selectedIndex)">
<option
value="1">Option
1</option>
<option
value="2">Option
2</option>
<option
value="3">Option
3</option>
</select>
<br>
<input
type="text"
id="text1"
value="First
text"><br>
<input
type="text"
id="text2"
value="Second
text"><br>
<input
type="text"
id="text3"
value="Third
text"><br>