Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

86
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda