Sha256: d25992ae5829fb0be5839bf45c7977f5db57d3535d6b5ae830f2e6dbe2511066
Contents?: true
Size: 690 Bytes
Versions: 9
Compression:
Stored size: 690 Bytes
Contents
export default class Default { constructor(element, url) { this.url = url; element.autocomplete(this.options(element)); } options(element) { return { minLength: 2, source: (request, response) => { $.getJSON(this.url, { q: request.term }, response ); }, focus: function() { // prevent value inserted on focus return false; }, complete: function(event) { $('.ui-autocomplete-loading').removeClass("ui-autocomplete-loading"); }, select: function() { if (element.data('autocomplete-read-only') === true) { element.attr('readonly', true); } } }; } }
Version data entries
9 entries across 9 versions & 1 rubygems