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

**URL:** <https://www.phphelp.com/t/search-function-add-more-values-for-the-result-to-appear-for/35073>\
**Category:** Javascript & Ajax\
**Created:** [October 17, 2022, 1:19pm UTC](https://www.phphelp.com/t/search-function-add-more-values-for-the-result-to-appear-for/35073 "2022-10-17T13:19:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![darren\_azzopardi](https://www.phphelp.com/user_avatar/www.phphelp.com/darren_azzopardi/32/3014_2.png) [@darren\_azzopardi](https://www.phphelp.com/u/darren_azzopardi)\
**Post date:** [October 17, 2022, 1:19pm UTC](https://www.phphelp.com/t/search-function-add-more-values-for-the-result-to-appear-for/35073/1 "2022-10-17T13:19:42Z")

</div>

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

```auto
 $( "#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 );
			 };

```
