Value field type changing implemented

This commit is contained in:
eoghan.conlon 2023-08-08 18:22:03 +01:00
parent c0d3d6392b
commit fe3d095544

View file

@ -8,10 +8,10 @@
<body>
<form id="recovery">
<label for="options">Options</label>
<select id="options">
<select onChange="selectField()" id="options">
<option value="" selected="selected">Please select an option</option>
<option value="user">Username</option>
<option value="pass">Password</option>
<option value="email">Password</option>
</select> <br />
<label for="value">Value</label>
<input type="text" id="value" name="value" /> <br />
@ -28,7 +28,15 @@
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>
</body>
<script>