Skip to content

Instantly share code, notes, and snippets.

@olimortimer
Created September 30, 2013 10:07
Show Gist options
  • Save olimortimer/6761771 to your computer and use it in GitHub Desktop.
Save olimortimer/6761771 to your computer and use it in GitHub Desktop.
JS: Bootstrap Typeahead FastClick 'needsclick'
// Add our 'needsclick' to our a href for each item, so FastClick doesn't get applied
$('#typehead').data('typeahead').render = function (items) {
// We basically do what the normal typeahead function does...
var that = this;
items = $(items).map(function (i, item) {
i = $(that.options.item).attr('data-value', item);
// ...but we add 'needsclick' to the a href
i.find('a').addClass('needsclick').html(that.highlighter(item));
return i[0];
})
this.$menu.html(items);
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment