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 689927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:22:59+00:00 2026-05-14T02:22:59+00:00

When a user starts typing on the searchbox, the suggestion page returns the latest

  • 0

When a user starts typing on the searchbox, the suggestion page returns the latest item from all collections matching that nama, plus other data.

I’d like to show that item (along its image), and a link to “see all items from this collection”.

I can do (most of) that with the following code:

$('#search').autocomplete({
    source: function (request, response) {
        $.ajax({
            url: suggesturl,
            dataType: 'json',
            data: request,
            success: function (data) {
                response(data.map(function (value) {
                    return {
                        'label': '<img src="' + value.thumbsmall + '" />' + value.name + '<a href="/">More items from this collection...</a>',
                        'value': value.fullname
                    };  
                }));
            }   
        }); 
    },  
    minLength: 3
})

The problem is that, although the link appears in the box, when it’s clicked it gets ignored, and the default select action is executed (the item’s value is put into the textbox).

  • 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-14T02:22:59+00:00Added an answer on May 14, 2026 at 2:22 am

    Seems like you have a couple options. First, you can specify your own select action, using a select option on the autocomplete initializer.

    $(selector).autocomplete({
        source: ... ,
        select: function(value, data){
              if (typeof data == "undefined") {
                  emitMessage('You selected: ' + value + "<br/>");
              } else {
                  emitMessage('You selected: ' + data.item.value + "<br/>");
              }
        }
    });
    

    If that is not sufficient, for some reason, then you can render your own content for the autocomplete list, and in that way get as much control as you need.
    You do that by monkey-patching the _renderItem fn, which is what autocomplete calls to render each item in the list. Check this answer for how to do it. It works in v1.8rc3.

    I suppose in _renderItem you could render a clickable <span>, and attach any logic you like to the click event.

    If you go that route, you may have a need to turn OFF the default click action. I think autocomplete uses an <a> for the element that provides the click event. In that case, you’ll need to unset that click handler.

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

Sidebar

Related Questions

VB.NET Winforms Application... When a user starts typing in the search box of the
When the user starts typing in a combobox, auto-complete kicks in and shows the
Hie We are using a gwt SuggestBox which shows suggestions as user starts typing
I have a form with a textfield element which when a user starts typing
when the user starts my app, there is a lot of data coming from
How can I avoid that a user starts the same program twice? The current
How can i do something like that: when user starts my C# application if
I have a textbox with default text like Enter Name Once user starts typing
when the user starts typing the text in to the text box we need
So here's what I already have: When a user starts typing into a text

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.