I have a custom dropdown in angular JS which is a combination of textbox and list. Here on keydown event I am checking the key code and getting the char from String.fromCharCode(keyCode)
. and apply the style(highlighted) for the typed character from the list. This works fine for a single character.
for example in my list iam having {'india','ireland','egypt','england','nigeria'}
Here my code works if I type e
it will point to the first country Egypt. My requirement is if I type en
continuously it should highlight England, but this is not happening. As soon as I type n
it will highlight Nigeria. because the keydown event is immediately firing and it is selecting for next char entered.
elem.on('keydown.ddl', function (e) {
case (keyCode >= 65 && keyCode <= 90):
var keyChar = String.fromCharCode(keyCode); //this give
//here i am changing the style
break;
});