How to leave a "selectable" list with js / jquery?

0

Hello, I did an autocomplete but I can not leave the list selectable with the keyboard, I can only select with the mouse through the mouseover function, would anyone have any solution for this? follow the code:

  function autoBanco(event, ds){

    if(event.keyCode != 37 && event.keyCode != 38 && event.keyCode != 39 && event.keyCode != 40){
      $('#bds').empty();
    $.ajax({
      type: "GET",
      url: "{{url('pesquisaBanco')}}",
      data: {dados : ds },
      dataType: "JSON",
      success: function (response) {
        var b = response.Banco;
         console.log(b);

         b.forEach(element => {
          $('#bds').append('<li  class="list-group-item list-group-item-action" data-toggle="list" role="tab"  id="${element['ID_CD_BANCO']}" value="${element['ID_CD_BANCO']}" onclick="$('#ds_banco').val(this.innerHTML),$('#bds').empty()" 
          onmouseover="$('#${element['ID_CD_BANCO']}').addClass('active'),$('#ds_banco').val(this.innerHTML)" onmouseleave="$('#${element['ID_CD_BANCO']}').removeClass('active') ">${element['NM_BANCO']}</li>');         
         });
      }
    });
    }
  }
    
asked by anonymous 08.10.2018 / 19:14

0 answers