Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom event not triggered #1776

Open
luisalmeida12 opened this issue Dec 25, 2019 · 3 comments
Open

Custom event not triggered #1776

luisalmeida12 opened this issue Dec 25, 2019 · 3 comments

Comments

@luisalmeida12
Copy link

I'm trying to trigger a custom event like:

typeahead:select but nothing happens. my code is listing the info I want but then when i select nothing happens.
What am I doing wrong?

var route = "autocomplete";
    $('.clientName').typeahead({
        minLength: 1,
        highlight: true,
        source:  function (term, process) {
          return $.get(route, { term: term }, function (data) {
                return process(data);
            });
        }
        
    });

    $('.clientName').on('typeahead:select', function(ev, suggestion) {
      alert("here");
      console.log('Selection: ' + suggestion);
  });
@elzix
Copy link

elzix commented Jan 23, 2020

+1

Console logs nothing when I use (from docs)

jQuery('.typeahead').bind('typeahead:select', function(ev, suggestion) {
  console.log('Selection: ' + suggestion);
});
jQuery('.hotel_name').bind('typeahead:select', function(ev, suggestion) {
  console.log('Selection: ' + suggestion);
});

Console logs undefined when I try to add in definition:

jQuery('.hotel_name').typeahead({
  source: function (query, result) {
    jQuery.ajax({ ... });
  },
  select: function (ev, suggestion) {
    console.log('Selection: ' + suggestion);
  }
});

What are we missing?

@luisalmeida12
Copy link
Author

@elzix looks this is not being supported. :/

@Canyoneer
Copy link

The events were changed with version 0.11.0. You are probably using an older version.
In 0.10.5 typeahead:select is typeahead:selected and typeahead:open is typeahead:opened.

This should be in the documentation, but it would probably be better to switch to a supported fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants