Skip to content

Instantly share code, notes, and snippets.

@superlou
Created June 3, 2012 19:11
Show Gist options
  • Save superlou/2864675 to your computer and use it in GitHub Desktop.
Save superlou/2864675 to your computer and use it in GitHub Desktop.
Bootstrap Typeahead not seeing options
$(document).ready(function() {
...
$('.typeahead').typeahead({
source: ["dogs","dolphins"]
});
...
!function($){
"use strict"; // jshint ;_;
/* TYPEAHEAD PUBLIC CLASS DEFINITION
* ================================= */
var Typeahead = function (element, options) {
console.log(options);
this.$element = $(element)
this.options = $.extend({}, $.fn.typeahead.defaults, options)
this.matcher = this.options.matcher || this.matcher
this.sorter = this.options.sorter || this.sorter
this.highlighter = this.options.highlighter || this.highlighter
this.updater = this.options.updater || this.updater
this.$menu = $(this.options.menu).appendTo('body')
this.source = this.options.source
this.shown = false
this.listen()
}
...
Object
provide: "typeahead"
typeahead: Typeahead
$element: jQuery.fn.jQuery.init[1]
$menu: jQuery.fn.jQuery.init[1]
highlighter: function (item) {
matcher: function (item) {
options: Object
shown: false
sorter: function (items) {
source: Array[0]
updater: function (item) {
__proto__: Object
__proto__: Object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment