Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4001592
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:55:26+00:00 2026-05-20T07:55:26+00:00

I would like the autocomplete to display a footer which says Displaying top 5

  • 0

I would like the autocomplete to display a footer which says Displaying top 5 results only when there are 5 results actually being displayed.

So far, I have it set up so that it won’t display if at first there are less than 5 results, but once 5 results have been loaded the footer always displays, regardless of how many results are actually being displayed.

Please excuse the silly flip gimmick.

oAC.formatResult = function(oResultData, sQuery, sResultMatch) {
         var sKey = sResultMatch

         // Extract the part of the match that the user did not type
         var sKeyRemainder = sKey.substr(sQuery.length);


         oAC.setFooter("");
         var aMarkup = ["<div class='myCustomResult'>",
                             "<span style='font-weight:bold'>",
                             sQuery,
                             "</span>",
                             sKeyRemainder,
                             "<br>",
                             "</div>"];

         if (oResultData[2] >= 4) {
            flip = true;
         }
         if (flip) {
            oAC.setFooter("<div style=\"margin-left:5px;\"><span style=\"font-weight:bold;\">See more results for " + sQuery + "</span><br>Showing top 5 results</div>");
         }
         return (aMarkup.join(""));
      };
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T07:55:26+00:00Added an answer on May 20, 2026 at 7:55 am

    Instead of trying to set it in the formatResult function, I tried using the doBeforeExpandContainer function, and it works like a charm.

    oAC.formatResult = function(oResultData, sQuery, sResultMatch) {
       var sKey = sResultMatch
    
       // Extract the part of the match that the user did not type
       var sKeyRemainder = sKey.substr(sQuery.length);
    
    
       oAC.setFooter("");
       var aMarkup = ["<div class='myCustomResult'>",
                           "<span style='font-weight:bold'>",
                           sQuery,
                           "</span>",
                           sKeyRemainder,
                           "<br>",
                           "</div>"];
    
       oAC.setFooter("<div class=\"ac-footer\"><div class=\"ac-footer-content\"><a class=\"ac-footer-link\" href=\"#\" onclick=\"spandex(this,event,'filter-company');return false;\">See more results for <b>" + sQuery + "</b></a><br><span class=\"ac-footer-sub\">Showing top 5 results</span></div></div>");
    
       return (aMarkup.join(""));
    };
    
    oAC.doBeforeExpandContainer = function(sQuery, oResponse) {
       if (oAC._nDisplayedItems <= 5) {
          oAC.setFooter("");
       }
    
       return true;
    }
    

    doBeforeExpandContainer is called every time the container opens (just as you would expect it to) and _nDisplayedItems is how many items are going to be displayed in the list (also as you would expect).

    So when results are retrieved, the footer is added every time. Then, before the box shows, if there are five or less results, the footer is removed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jQuery autocomplete and would like to limit the showing results only
I would like the autocomplete to display no results in it's drop down list
I have an autocomplete box which I would like to be able to close
I would like to have a TextBox that supports AutoComplete and lets users type
Would like to know the c# code to actually retrieve the IP type: Static
I'm using JQuery UI's autocomplete widget and would like to have access to the
I would like to add autocomplete to my tagging functionality. A couple of questions:
I would like to trigger some jQuery autocomplete events from outside of autocomplete but
I would like to scroll through the jQuery UI autocomplete suggestions when the user
I am using jQuery Ui Autocomplete 1.8.14 and I would like to do two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.