Smart Suggest - jQuery help
I purchased the following jQuery widget from CodeCanyon - http://jamesskidmore.com/scripts/smartsuggest/ and the only thing missing in the widget is a keyup/keydown handler to highlight the selections in the list.
I am not very familiar with jQuery itself and am wondering if anyone would be able to do this?
I managed to bind the event but have no idea on how to handle the navigation:
$('#searchField').bind("keydown.autocomplete",function(c){
switch(c.keyCode) {
case 38: // UP
alert('Keyup');
break;
case 40: // DOWN
alert('Keydown');
break;
}
});
开发者_如何学编程
The dropdown list has no active state (only css :hover
), so you'll have to add that too. You'd also have to add the enter event, so simulate a mouseclick on the :hover
element.
Something like this: http://jsfiddle.net/rudiedirkx/PWE2S/
精彩评论