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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:08:23+00:00 2026-06-06T14:08:23+00:00

I currently have a ajax script that dynamically builds two select boxes enabled with

  • 0

I currently have a ajax script that dynamically builds two select boxes enabled with the Chosen plugin found here: https://github.com/harvesthq/chosen. I’ve narrowed down that Line 9 is what enables the Chosen Plugin and from what I can tell the scripts builds the markup for the selects dynamically. How do I split this building of the dynamic select markup so that the first select is NOT enabled with the Chosen plugin?

$(function(){

    var questions = $('#questions');

    function refreshSelects(){
        var selects = questions.find('select');

        // Improve the selects with the Chosen plugin
        selects.chosen({ disable_search_threshold: true });

        // Listen for changes
        selects.unbind('change').bind('change',function(){

            // The selected option
            var selected = $(this).find('option').eq(this.selectedIndex);
            // Look up the data-connection attribute
            var connection = selected.data('connection');


            // Removing the li containers that follow (if any)
            selected.closest('#questions li').nextAll().remove();

            if(connection){
                fetchSelect(connection);
            }

        });
    }

    var working = false;

    function fetchSelect(val){

        if(working){
            return false;
        }
        working = true;

        $.getJSON('citibank.php',{key:val},function(r){

            var connection, options = '';

            switch (r.type) {
                case 'select':
                    $.each(r.items,function(k,v){
                        connection = '';
                        if(v){
                            connection = 'data-connection="'+v+'"';
                        }

                        options+= '<option value="'+k+'" '+connection+'>'+k+'</option>';
                    });

                    if(r.defaultText){

                        // The chose plugin requires that we add an empty option
                        // element if we want to display a "Please choose" text

                        options = '<option></option>'+options;
                    }

                    // Building the markup for the select section

                    $('<li>\
                        <p>'+r.title+'</p>\
                        <select data-placeholder="'+r.defaultText+'">\
                            '+ options +'\
                        </select>\
                        <span class="divider"></span>\
                    </li>').appendTo(questions);

                    refreshSelects();
                    break;
                case 'html':
                    $(r.html).appendTo(questions);
                    break;
            }

            working = false;
        });

    }

    $('#preloader').ajaxStart(function(){
        $(this).show();
    }).ajaxStop(function(){
        $(this).hide();
    });

    // Initially load the product select
    fetchSelect('callTypeSelect');
});
  • 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-06T14:08:26+00:00Added an answer on June 6, 2026 at 2:08 pm

    :not and :first.

    selects.filter(":not(:first)").chosen({ disable_search_threshold: true });
    

    or

    selects.not(":first").chosen({ disable_search_threshold: true });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a PHP form that uses AJAX to connect to MySQL and
I currently have the following JavaScript/jQuery script that gets an external html page using
I currently have an Instance of the ASP.net ajax control toolkit combo box residing
How can I modify this: /services/type/single_dwelling/ to this: /ajax/services/single_dwelling/development Currently I have: linkUrl =
I have an element which autosaves its contents via an AJAX call. Currently, whenever
I'm currently trying to get to grips with AJAX, and have a problem accessing
Currently, I am using an with ajax to update my mysql. Now, I have
O, so i have a 'live search' ajax search, which currently runs an sql
I currently have this script : function addConsultant() { var sheet_staffing = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(Staffing); var
I am currently developing a website and i need that the pages loads dynamically

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.