Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

88
Visualizações
Typeahead Bloodhound don't close the autocomplete on click

I have a problem that I can't solve, when I click on one of the a tags (js-follow class), a function is triggered to follow / unfollow a user, however the div that contains the auto complete suggestions closes at the slightest click, and I can't keep it open. Do you have a solution to prevent it from closing on click, while executing my function ? Thank you so much !

Here is my code :

$(document).ready(function () {
  var datas = new Bloodhound({
    datumTokenizer: Bloodhound.tokenizers.whitespace,
    queryTokenizer: Bloodhound.tokenizers.whitespace,
    remote: {
      url: "",
      wildcard: "",
      filter: function (datas) {
      },
    },
  });

  datas.initialize();
  $("#tags").typeahead(
    { hint: false },
    {
      name: "datas",
      source: datas.ttAdapter(),
      display: "item",
      templates: {
        suggestion: function (item) {
          return (
            `<ul></ul>`)
          );
        },
      },
    }
  );
});
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I found the solution. For anyone who is facing this problem, here is the way to do it :

$(document).on("typeahead:beforeselect", function (event, data) { event.preventDefault(); });
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda