jQueryUI Autocomplete widget: categories example: how do I customize the list?

Hi there,

I am using the jQueryUI autocomplete widget and I have started with the categories example and I need that for what I am doing.

However, I also need to be able to customize the list items and I do not know how to alter that example to do so.  

I would like to be able to add a second line under the main line item and style the contents of the second line.

Something like this:

andreas andresen
This is a description line in italic for the item
andreas johnson
This is a description line in italic for this item



I have this as a working example on jsFiddle - up to the point where I need to be able to alter the item output:

My jQueryUI Categories Sample
srbarker8Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:
Hi,

You need to replace the function _renderItem. It is located inside http://code.jquery.com/ui/1.11.4/jquery-ui.min.js file that you have used.

I have updated the original file and attached here. Updated function is given below.

_renderItem: function(t, i) {
    return e("<li>").text(i.label + <"br /><i>" + i.desc + "</i>").appendTo(t)
}

Open in new window

jquery-ui.txt
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.