I have an HTML select list that, when an element is selected, should show other information below it. Onclick or jQuery change events are fired when a selection list item is selected by clicking with the mouse (mouse), but not when the user uses keystrokes (keyboard).
Any idea which event you need to look to determine when the selected list item has changed?
Here is a BASIC example:
<select id="mylist" name="mylist">
<option value="">(none)</option>
<option value="1">Test 1</option>
<option value="2">Test 2</option>
<option value="3">Test 3</option>
</select>
<span id="myspan"></span>
<script type="text/javascript">
$("#mylist").change(function() {
$("#myspan").html($("#mylist").attr("selectedIndex"));
});
</script>
Jimbo source
share