Sha256: 337b0a00d51987c042832a0f2103bfbd1a62011bd26d32d86add0819c18ccdd1
Contents?: true
Size: 877 Bytes
Versions: 63
Compression:
Stored size: 877 Bytes
Contents
function groupsAutocomplete() { $.get('/admin/groups.json', function(data) { $("input.groups-completer").autocomplete({ minLength: 0, source: function(request, response) { // delegate back to autocomplete, but extract the last term response($.ui.autocomplete.filter(data, request.term.split(/,\s*/).pop())); }, focus: function() { // prevent value inserted on focus return false; }, select: function(event, ui) { var terms = this.value.split(/,\s*/); // remove the current input terms.pop(); // add the selected item terms.push( ui.item.value ); // add placeholder to get the comma-and-space at the end terms.push(""); this.value = terms.join(", "); return false; } }); }); } $(function() { groupsAutocomplete(); });
Version data entries
63 entries across 63 versions & 1 rubygems