javascript - Keep focus on dropdown list while writing in input text -


i kind of new in angularjs , bootstrap, , help.

i trying create dynamic dropdownlist filters input text. here code:

<input id="selectedcountry" type="text" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="true" ng-model="pass" autocomplete="off"  /> <ul class="dropdown-menu">   <li data-ng-repeat="r in countrycodes | myfilter *my filter in app.filter. works fine*"><a href="#" data-ng-click="selectedcountry.value=r.value">{{r.name}}</a></li> </ul> 

i everytime user clicks on down arrowkey focus on dropdownlist (which not happening automatically, why?), wrote code:

$(document).on('shown.bs.dropdown', function (event) {     var dropdown = $(event.target);     $("input").keydown(function (e) {         if ((e.which && e.which == 40) || (e.keycode && e.keycode == 40)) {             // set aria-expanded true             dropdown.find('.dropdown-menu').attr('aria-expanded', true);              // set focus on first link in dropdown             dropdown.find('.dropdown-menu li:first-child a').focus();              return false;         } else {             return true;         }     }); }); 

my problem when user presses down arrow key focus not on input text more, can't keep writing.

how can make dynamic dropdownlist user can keep writing while focus on menu? tried using jquery filter didn't work out because have use angularjs can trigger data-ng-click while user chooses option, , in addition options data-ng-repeat can't use default "select" , "option" tags in html. everywhere searched solution says can't elements focused @ same time. perhaps there option? because there alot of websites case?

thankyou help

yes, you're right. can't 2 elements focused @ same time.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -