Search function | add more values for the result to appear for

Hi all,

I’ve go a search function (auto complete) that allows the user to begin typing what they want and the closes match appears.

But question is, because there could be several search terms for a particular item, I’m wanting the add to script something along the lines of: "if the value that is typed in “book a” or “book-a” still return the same result.

Currently it seems to be looking at the label field to find what its looking for

 $( "#project" ).autocomplete({
               minLength: 0,
               source: projects,
               focus: function( event, ui ) {
                  $( "#project" ).val( ui.item.label );
                     return false;
               },
               select: function( event, ui ) {
                  $( "#project" ).val( ui.item.label );
                  $( "#project-id" ).val( ui.item.value );
                  $( "#project-description" ).html( ui.item.desc );
				  
                  return false;
               },
			 
			 source: projects,
               open: function( event, ui ) {
                var len = $('.ui-autocomplete > li').length;
    console.log('Founded '+len+' results');
				   console.log( $( "#this" ).html('There are '+len+' results') ) 
				   $( ".ui-menu-item:nth-child(5)" ).append( '<li class="more_results"><div><em>Including '+len+' additional results which match your search &nbsp;&nbsp;</em><a href="all-courses.asp">Browse all courses</a></div></li>' );
               }
            })
			
Thanks for your feedback			
			 
            .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
               return $( "<li>" )
               .append( item.desc )
               .appendTo( ul );
			 };
Sponsor our Newsletter | Privacy Policy | Terms of Service