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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:25:16+00:00 2026-06-04T23:25:16+00:00

I am trying to use jquery autocomplete and custom html to add a image

  • 0

I am trying to use jquery autocomplete and custom html to add a image in my dropdown. for some reason, when I set up the image, the autocomplete looks fine when I enter a name (I see the picture and the label just fine), but when I arrow down to select, i get an error that says ui.item is not defined for focus and select events. If I follow that standard format shown in the example page, everything works fine.

(the one from the jquery doc – works as expected)

.append( "<a>" + item.label + "<br>" + item.value + "</a>" )  

but when I use this one to show an image, the autocomplete lists shows with pics, but the focus and select events dont work

$( "#friends" ).autocomplete({
    minLength: 2,
    source: friend_data,
    delay: 0,
    autofocus: true,
    focus: function(event, ui) {
        $( "#friends" ).val( ui.item.label );
        return false;
        },
    select: function( event, ui ) {
        $( "#friends" ).val( ui.item.label );
        return false;
        }    
    })
    .data( "autocomplete")._renderItem = function( ul, item ) {
        var fb_pic_path = '<img src="http://graph.facebook.com/' + item.value + '/picture?type=square">' ;
        console.log(fb_pic_path);
        return $( "<li></li>" )
        .data( "item.autocomplete", item )
        .append(  fb_pic_path +  item.label  )
        .appendTo( ul );
    };
  • 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-06-04T23:25:18+00:00Added an answer on June 4, 2026 at 11:25 pm

    ah.. figured it out. needs the anchor.

    .append( "<a>" + fb_pic_path + item.label + "</a>" )
    

    and it works fine now.

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

Sidebar

Related Questions

I'm trying to use JQuery's autocomplete plug-in but for some reasons Internet Explorer is
I am trying to use jquery autocomplete plugin, I want it to suggest ItemCodes
im trying to use the jQuery UI autocomplete to communitate with a webservice with
I'm trying to use the autocomplete plugin for jQuery (this one http://docs.jquery.com/Plugins/Autocomplete ). My
I'm trying to use for the first time the autocomplete feature of jquery ui,
I am trying to use jQuery autocomplete on my dynamically created textboxes. this is
In my rails application I am trying to use rails3-jquery-autocomplete gem. I included the
I'm trying to use the AutoComplete feature of JQuery to update multiple fields on
I'm trying to use the official jQuery autocomplete plugin with an ASMX web service
I'm really struggling trying to use the jQuery UI autocomplete plugin. I've had a

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.