[jQuery] Selecting a value with up down keys
Hi,
I'm trying to figure out how to select a value from a list that is
filled dynamically using ajax
auto suggest
.
Take a look at the small code:
when typing in a name by the keyboard this function is called:
function lookup
inputString,a
{
if
inputString.length == 0
{
// Hide the suggestion box.
$
'#suggestions'
.hide
;
} else {
$.post
"autoComplete/rpc.php", {queryString: ""
inputString
""} ,
function
data
{
if
data.length >1
{
$
'#suggestions'
.show
;
$
'#autoSuggestionsList'
.html
data
;
}
}
;
}
}
An when choosing a value from the given back values list $
'#autoSuggestionsList'
.html
data
; then the next function does his
work:
function fill
thisValue
{
$
'#inputString'
.val
thisValue
;
$
'#suggestions'
.fadeOut
"slow"
}
But now i want to use the up and down keyboard keys to get to the next
value and choose it by enter.
I wonder if there is a simple jquery solution for this?
thank you for your help in advance :
regards
m.sirin