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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:37:27+00:00 2026-06-09T22:37:27+00:00

Im trying to build my dropdown menu using the plugin Chosen for Multiple Select

  • 0

Im trying to build my dropdown menu using the plugin Chosen for Multiple Select .
Here’s to behavior I’m based on:

http://jsfiddle.net/JfLvA/

So, instead of having 3 harcoded < option > in my select. I want this list to be the values of a json array populated by an ajax request. This will be triggered by autocomplete.

So, if the user type “car”, im sending the letter via an ajax call, and im getting back an array like that:

[{“id”:”2489″,”name”:”carrie”},{“id”:”2490″,”name”:”Caroline”},{“id”:”2491″,”name”:”Carole”}]

The code:

$(function() {

$(".chzn-select").chosen();
$(".chzn-select-deselect").chosen({allow_single_deselect:true});

$('.chzn-choices input').autocomplete({
   source: function( request, response ) {
      $.ajax({
          url: "/change/name/autocomplete/"+request.term+"/",
          dataType: "json",
          success: function( data ) {
             response( $.map( data, function( item ) {
                $('ul.chzn-results').append('<li class="active-result">' + item.name + '</li>');

          }
       });
    }
});

Result:

I type “car”, in the dropdown Im getting “No result for car” and then I have all my results, as I want.

1. Why I’m I getting the “No result” message, cause I can see in my json array and inside my list that I’m getting results.

 -----------------------------

When I delete “car” and enter “sam”. The results for “sam” are showing after the “car” results. (Basically, I see the result for both, instead of just having the result of my current search)

2. Im I suppose to clear the ul on keyUp?? Thought the plugin was doing that already

 -----------------------------

When I click on a name to actually select it and add it into the select, Im getting a javascript error inside the chosen.js file

item is undefined
“item.selected = true;” line 732

the link to the plugin:
http://harvesthq.github.com/chosen/chosen/chosen.jquery.js

and it’s not adding anything inside the select.

3. No idea why this is happening

 -----------------------------

Do you guys have any idea on what I’m I doing something wrong? I’m completly stuck here…!

Oh and by the way, I dont mind changing the plugin source, as it’s the only place where I’m using it….

  • 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-09T22:37:29+00:00Added an answer on June 9, 2026 at 10:37 pm

    try this:

    $('.chzn-choices input').autocomplete({
      source: function( request, response ) {
        $.ajax({
          url: "/change/name/autocomplete/"+request.term+"/",
          dataType: "json",
          beforeSend: function(){$('ul.chzn-results').empty();},
          success: function( data ) {
            response( $.map( data, function( item ) {
              $('ul.chzn-results').append('<li class="active-result">' + item.name + '</li>');
            }));
          }
        });
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to WPF and I'm trying to build a dropdown menu using the
I'm following this tutorial and am trying to modify it to my use: http://net.tutsplus.com/tutorials/html-css-techniques/how-to-build-a-kick-butt-css3-mega-drop-down-menu/
I am trying to build a fancy jquery dropdown menu ,while making the menu
I'm trying to build a jquery dropdown menu, basically I have the left navigation
I am trying to build a CSS dropdown menu. The problem is that all
I'm trying to build my own custom dropdown menu that should remember it's vertical
I'm trying to build a select-box like custom dropdown that should close whenever I
I am trying to dynamically build a drop down menu using PHP. The idea
I am trying to build a multi-level dropdrown menu, I'm using umbraco cms. What
I'm trying to use dropkick.js to build a dropdown menu in a web app.

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.