Autocomplete + Drop-down p.2 – Mea Cup O' Jo
Skip to content


Autocomplete + Drop-down p.2

So I decided not use 2 different controls but instead to enhance autocomplete with ability to behave as drop-down if number of items fails under specified treshhold. Here are the steps (I’m using QuickSelect plugin)

  1. Add image button into right side corner of the original input field. I’m nesting both input and image withing a single div and then position image as absolute
  2. QuickSelect creates quick object that contains all the data that I need. The problem is – this object is private and I cannot access it. Unfortunately the only way is to hack into code. I ended up adding a filed to the original Input that creates a reference to Quick object, then in my code I refer to it as $(’#myQuick’)[0].quick.
    Then I call (fortunately public) method of QuickSelect to populate drop-down list (glorified UL list) with the data and associate that code with onClick event of the button I created in step #1. The code looks something like this:
                if (data.length < 20) {
                    var btt = $('

The result is – pleasantly looking dropdown that as added bonus maintains autocomplete functionality

Posted in Web stuff, jQuery.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.