/****************************************** * jQuery Mobile plugins for Tailbone *****************************************/ /****************************************** * mobile autocomplete *****************************************/ (function($) { $.widget('tailbone.mobileautocomplete', { _create: function() { var that = this; // snag some element references this.search = this.element.find('.ui-input-search'); this.hidden_field = this.element.find('input[type="hidden"]'); this.text_field = this.element.find('input[type="text"]'); this.ul = this.element.find('ul'); this.button = this.element.find('button'); // establish our autocomplete URL this.url = this.options.url || this.element.data('url'); // NOTE: much of this code was copied from the jquery mobile demo site // https://demos.jquerymobile.com/1.4.5/listview-autocomplete-remote/ this.ul.on('filterablebeforefilter', function(e, data) { var $input = $( data.input ), value = $input.val(), html = ""; that.ul.html( "" ); if ( value && value.length > 2 ) { that.ul.html( "