0

I want to rip out the ul out of the jQuery autocomplete and replace it with select-options (a regular drop-down). Please note that, I want to replace the sucker, not embed the drop-down in it which is the kind of solution I have been seeing on other topics.

Thanks!

Mossi
  • 907
  • 5
  • 15
  • 26
  • Can you mention some code or some more details of what you are trying to achieve. May be some sample input and output. – Wolf Dec 31 '12 at 20:17
  • I'm using jQuery autocomplete, which utilizes an unsorted list to show the selections. I want to actually replace this list with my own custom list, in this case a select-option HTML dropdown. – Mossi Dec 31 '12 at 20:25
  • 1
    Can you please add the HTML you have now, and the expected HTML – Wolf Dec 31 '12 at 20:29
  • Are you thinking of hacking into it by replacing the list after it's been rendered? If so then that's not exactly what I'm looking for. I was hoping maybe the autocomplete widget had something built-in that I could override. – Mossi Dec 31 '12 at 20:34
  • Yea. It was not clear in your question. – Wolf Dec 31 '12 at 20:38
  • Just found this: http://stackoverflow.com/questions/11028642/how-to-remove-bullets-from-jquery-autocomplete-result

    It works for me.

    – user1788506 Jan 25 '17 at 17:54

1 Answers1

0

Are you talking about jQuery UI's Autocomplete widget?

If so, it doesn't support customizing the output elements the way you want. If you check out the source, you'll see that the <ul> and <li> elements are very much hardcoded in there. Any solution would require the sort of after-the-fact hacking you're trying to avoid.

https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.autocomplete.js#L183

https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.autocomplete.js#L535

You could, of course, just fork jQuery UI.

Nate
  • 4,498
  • 2
  • 26
  • 24
  • Well, that's quite the bad news for a New Year eve. – Mossi Dec 31 '12 at 22:15
  • Time to roll your own version! It wouldn't be hard to clone their widget, change the name slightly, and make your element changes. (You could even extend it to allow the kind of custom UI elements you want and make it available to others.) – Nate Jan 02 '13 at 13:25