Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

81
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!