Value field type changing implemented
This commit is contained in:
parent
c0d3d6392b
commit
fe3d095544
1 changed files with 11 additions and 3 deletions
|
@ -8,10 +8,10 @@
|
||||||
<body>
|
<body>
|
||||||
<form id="recovery">
|
<form id="recovery">
|
||||||
<label for="options">Options</label>
|
<label for="options">Options</label>
|
||||||
<select id="options">
|
<select onChange="selectField()" id="options">
|
||||||
<option value="" selected="selected">Please select an option</option>
|
<option value="" selected="selected">Please select an option</option>
|
||||||
<option value="user">Username</option>
|
<option value="user">Username</option>
|
||||||
<option value="pass">Password</option>
|
<option value="email">Password</option>
|
||||||
</select> <br />
|
</select> <br />
|
||||||
<label for="value">Value</label>
|
<label for="value">Value</label>
|
||||||
<input type="text" id="value" name="value" /> <br />
|
<input type="text" id="value" name="value" /> <br />
|
||||||
|
@ -28,7 +28,15 @@
|
||||||
alert('Not implemented yet');
|
alert('Not implemented yet');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectField(){
|
||||||
|
const field = document.getElementById('options').value;
|
||||||
|
const inputEl = document.getElementById('value');
|
||||||
|
if(field === "email"){
|
||||||
|
inputEl.type = 'email';
|
||||||
|
} else {
|
||||||
|
inputEl.type = 'text';
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
|
|
Loading…
Reference in a new issue