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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:30:23+00:00 2026-05-28T07:30:23+00:00

$(#shout_field).live(‘keydown’, function (event) { if (event.keyCode === $.ui.keyCode.TAB && $(this).data(autocomplete).menu.active) { event.preventDefault(); } }).autocomplete({

  • 0
$("#shout_field").live('keydown', function (event) {
        if (event.keyCode === $.ui.keyCode.TAB && $(this).data("autocomplete").menu.active) {
            event.preventDefault();
        }
    }).autocomplete({
        minLength: 0,
        source: function (request, response) {
            var term = request.term,
                results = [];
            if (term.indexOf("@") >= 0) {
                term = extractLast(request.term);
                if (term.length >= 2) {
                    $.ajax({
                        type: "POST",
                        url: "/data/people.asp",
                        dataType: "json",
                        data: {
                            term: term
                        },
                        error: function (xhr, textStatus, errorThrown) {
                            alert('Error: ' + xhr.responseText);
                        },
                        success: function (data) {
                            response($.map(data, function (c) {
                                return {
                                    id: c.id,
                                    label: '<b>' + c.img + '</b>' + c.label,
                                    value: c.value
                                }
                            }));
                        }
                    });
                } else {
                    results = ['Type someones name to tag them in the status...'];
                }
            }
            response(results);
        },
        focus: function () {
            // prevent value inserted on focus
            return false;
        },
        select: function (event, ui) {
            var terms = split(this.value);

            // remove the current input
            terms.pop();
            // add the selected item
            terms.push(ui.item.value);
            // add placeholder to get the comma-and-space at the end
            terms.push("");
            this.value = terms.join("");

            $('body').data('tagged', this.value)

            var tagged_users = $("#tagged_users").val();
            $("#tagged_users").val(tagged_users + ui.item.id + ',')

            return false;
        }
    });

I can do it normally but with the autocomplete coming from a remote call I am getting confused… 🙁

The bit I am interested in is the part where c.img is in <b> tags, it isn’t rendering as HTML…

  • 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-28T07:30:23+00:00Added an answer on May 28, 2026 at 7:30 am

    You should override the private method _renderItem() of the plugin.
    This function is called for each item to be displayed.

    First argument represents the <ul> element the plugin creates to display the menu. The second argument is the current data item.

    By default the plugin generates a <ul> so in your overriden _renderItem() you should keep making a <li> but you can have anything in it.

    For your case, I would return a silghtly different array data object, it’s just to store data so it’s better to have everything separated:

    return {
        id: c.id,
        label: c.label,
        imgUrl: c.img,
        value: c.value
    }
    

    To implement the custom rendering method, you simply re-define a new function for the plugin instance. How does this work ?

    • When you call $('#myelement').autocomplete() the plugin instantiates and

      1. Generates the necessary markup, etc
      2. Adds the plugin instance to the element #myelement as jquery data under the name “autocomplete”
    • The plugin instance is then accessible by doing $('#myelement').data('autocomplete');

    • You can then define a new function for the method _renderItem

    This gives:

    $("#shout_field").autocomplete({
        ...
    })
    .data('autocomplete')  // get the instance of the plugin
    ._renderItem = function( ul, item ) {  // change the _renderItem method
    
        // "item" is the current data item, so { id, label, imgUrl, value }
    
    
        return $( "<li></li>" ) // generate a <li> element
    
                // store the data item (used by the plugin)
                .data( "item.autocomplete", item )
    
                // create the display you want into the <li>
                .append( '<img src="' + item.imgUrl + '" />' + '<a>' + item.label + '<br>' + item.desc + '</a>' )
    
                // add the <li> to the list
                .appendTo( ul );
    
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my php code: if (isset($_POST['data']) && is_array($_POST['data'])) { foreach ($_POST['data'] as $row
The short version of this question is: How can I take data that only
Short version: I want to trigger the Form_Load() event without making the form visible.
Short version: assuming I don't want to keep the data for long, how do
I'll keep this nice and short. I'm trying to post a value to a
Where in an MVC based architecture should the date formatting (long/short/time/no-time/UK/US) live? I want
Given this field: char lookup_ext[8192] = {0}; // Gets filled later And this statement:
I am currently working on a live search and I need to be able
This is maybe a long shot, but I have a custom field control that
Short version of Problem Autocomplete works when the input string matches the result string,

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.