Changes between Initial Version and Version 1 of Ticket #6989, comment 5


Ignore:
Timestamp:
Feb 15, 2011, 8:25:47 AM (11 years ago)
Author:
rdworth
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6989, comment 5

    initial v1  
    11Sorry you didn't find clarity in the examples I shared. A custom source is exactly how you implement custom search logic. Here's a better example that matches from the beginning of the string: http://jsbin.com/avoyu5
     2
     3
     4{{{
     5$( "#tags" ).autocomplete({
     6  source: function( request, response ) {
     7    var matches = $.map( availableTags, function(tag) {
     8      if ( tag.toUpperCase().indexOf(request.term.toUpperCase()) === 0 ) {
     9        return tag;
     10      }
     11    });
     12    response(matches);
     13  }
     14});
     15}}}