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

  • Home
  • SEARCH
  • 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 8585555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:05:39+00:00 2026-06-11T22:05:39+00:00

I have this javascript here is make to work like a search suggestion for

  • 0

I have this javascript here is make to work like a search suggestion for a music search engine. I have this problem at the first character typed it works fine but if i type more characters it show me me al the results in one line with no pics breaks and everithyng. please someone take a look and tell me what i do wrong. Here is the sample http://jsfiddle.net/coladeu/Qhj5N/24/

<script>var keyword;
    $("input#selectedInput").bind("autocompleteselect", function (event, ui) {        
alert("Sel item " + JSON.stringify(ui.item.json));
}).autocomplete({
appendTo: "#list",
source: function (request, response) {
    keyword= $('#selectedInput').val();
    //alert("success");
    $.ajax({
        url: "http://itunes.apple.com/search?term=" + keyword + "&entity=musicTrack",
        dataType: "jsonp",
        data: {
            featureClass: "P",
            style: "full",
            maxRows: 12,
            name_startsWith: request.term
        },
        success: function (data) {
            response($.map(data.results, function (item) {
                itunesJson = item;
                return {
                    label: "<li><img src='" + item.artworkUrl30 + "' alt='no photo'/>" + item.trackName + "</li>",
                }
            }));
            var elm = $("#list");
            elm.html(elm.text());
        },
    });
}
                     });​</script>
  • 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-11T22:05:41+00:00Added an answer on June 11, 2026 at 10:05 pm

    There are a few things going wrong here. The main issue is that you should be overriding the _renderItem function to customize display of the list as demonstrated in this demo.

    This means instead of populating the label property of each item with HTML, you should do something like this:

    $("input#selectedInput").bind("autocompleteselect", function(event, ui) {
        alert("Sel item " + JSON.stringify(ui.item));
    }).autocomplete({
        appendTo: "#list",
        source: function(request, response) {
            $.ajax({
                url: "http://itunes.apple.com/search?term=" + request.term + "&entity=musicTrack",
                dataType: "jsonp",
                data: {
                    featureClass: "P",
                    style: "full",
                    maxRows: 12,
                    name_startsWith: request.term
                },
    
                success: function(data) {
                    response($.map(data.results, function(item) {
                        itunesJson = item;
                        return {
                            imgUrl: item.artworkUrl30 ,
                            label: item.trackName
                        }
                    }));
                },
            });
        }
    }).data("autocomplete")._renderItem = function(ul, item) {
        return $("<li />")
            .data("item.autocomplete", item)
            .append("<a><img src='" + item.imgUrl + "' alt='no photo' />" + item.label + "</a>")
            .appendTo(ul);
    };​
    

    Example: http://jsfiddle.net/Qhj5N/26/

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

Sidebar

Related Questions

My javascript function looks like this - function updateSuccess(aEle) { //Here aEle doesn't have
Here is the situation. I have some javascript that looks like this: function onSubmit()
I have this simple function: <script type=text/javascript> //<![CDATA[ jQuery(function($){ function here(b){alert(b);} ; here(6); });
Here is the problem: I can't seem to make a YouTube video work while
Long time lurcher, first time poster here. I've been grappling with this problem for
I have this html page I copied from here . There is a javascript
I have this Javascript/JQuery code: <script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js></script> <script type=text/javascript> name = $(#name).val(); alert(Name:
I have this Javascript function that sends username and password to php file through
I have this Javascript: <script language=javascript type=text/javascript> $().ready(function() { $('#ex2').jqm({ajax: 'view.php?id=<?=$objResult[id];?>', trigger: 'a.ex2trigger'}); });
I have this Javascript code I inherited from another developer. I am very new

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.