funbinod Posted May 25, 2014 Share Posted May 25, 2014 i'm trying to learn jquery. while learning i'm trying autosuggest and i tried this <script type="text/javascript"> function lookup(inputString) { if(inputString.length == 0) { // Hide the suggestion box. $('#suggestions').hide(); } else { $.post("item.php", {queryString: ""+inputString+""}, function(data){ if(data.length >0) { $('#suggestions').show(); $('#autoSuggestionsList').html(data); } }); } } // lookup function fill(thisValue) { $('#inputString').val(thisValue); setTimeout("$('#suggestions').hide();", 200); }</script> it is working properly... but i wish the suggestion could be selected using up and down arrows on keyboard. can anyone suggest how can i do that? Link to comment Share on other sites More sharing options...
justsomeguy Posted May 27, 2014 Share Posted May 27, 2014 You'll need to add a keydown or keypress handler to the page which would check if the list is open, which item has focus, and move the focus. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now