Deleting an option value from a select box
I need your help.
I am still relatively new to javascript, and would like to accomplish the
following:
Using the 'delete' key on my keyboard, I would like to able to delete the
highlighted value from the drop down list depicted in this picture here:
and;
Using the delete key in the input box, I would like it to search for the
value given in the input box and delete the option from out of the drop
down box (as depicted in this picture here):
Here is the HTML markup:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function getvalue(x) {
document.getElementById('input').value = x
}
</script>
</head>
<body>
<input type="text" id="input">
<br>
<select id="list" onchange="getvalue(this.value)">
<option value=""></option>
<option value="ABC">ABC</option>
<option value="DEF">DEF</option>
<option value="GHI">GHI</option>
<option value="JKL">JKL</option>
<option value="MNO">MNO</option>
</select>
</body>
</html>
No comments:
Post a Comment