Giter Site home page Giter Site logo

typeahead's Issues

Deprecate maybe?

Deprecate this npm package and archive this unmaintained repo in favor of native datalist?
Native controls are much better IMO, works awesome on mobile too.

IE's is dead anyway

version without dependencies

I've forked typeahead and edited it to remove the dependencies. This changes the API a little - options.menu and options.item must now be passed as tag names, as opposed to HTML strings, e.g.:

new Typeahead(input, {
    menu: 'div',
    item: 'span'
});

Additionally, I changed the match handler a bit in order to accept objects as matches (as long as they have a value key). The other keys are added to the match item's dataset, then copied to the input upon selection. This makes then available for the event handler. For instance, the matches might be locations; the name is shown on screen, and the lat/long can be handled upon select:

new Typeahead(input, {
    source: function(query, callback) {
       callback([
         {value: 'some city', lat: 42, lng: -72},
         {value: 'some other', lat: -42, lng: 84}
       ])
   }
});

I also found that the change event wasn't working, it fires even when a final selection hasn't been made, so I've namespaced it to change.typeahead.

Would you be interested in a pull with these changes?

"typeahead:selected" and other custom events appear to be missing

With the jQuery version of this plugin, you can enable custom events with

$('input').typeahead(...).on('typeahead:selected', customHandler);

However, there appears to be no way to do this with the version on NPM when you initiate with

var input = $('input')
Typeahead(input, ...)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.