defunctzombie / typeahead Goto Github PK
View Code? Open in Web Editor NEWbootstrap compatible typeahead web component
License: Other
bootstrap compatible typeahead web component
License: Other
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
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?
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, ...)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.