I have a HTML form with a drop down list. I want to get the selected drop down value when the user select an option by arrow keys and presses enter key on one of the drop down options
HTML code:
<select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
When the user selects Mercedes and presses enter I want to get that value. I can get that value by
$('option').live('click',function(){
var text = $(this)
});
but I want to get it when they press the enter key
Here is a working example.
As oezi said, you might be looking for the change event, but if you really want to capture the enter keypress, this is the way to do it.