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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:07:43+00:00 2026-06-16T15:07:43+00:00

Possible Duplicate: How to add dynamically a combobox using jQuery Look, I’ve this working

  • 0

Possible Duplicate:
How to add dynamically a combobox using jQuery

Look, I’ve this working code for dynamic comboboxs.

<html>
<div id="combos" class="styled-select">
<select id="combo1" class="combo" data-index="1">
<option></option>
<option>sss</option>
<option>aaa</option>
<option>ddd</option>
</select>
</div>

<script>
$('#combos').on('change', '.combo', function () {
        var selectedValue = $(this).val();

        if ($(this).find('option').size() > 2) {
            var newComboBox = $(this).clone();
            var thisComboBoxIndex = parseInt($(this).attr('data-index'), 2);
            var newComboBoxIndex = thisComboBoxIndex + 1;
            $('.parentCombo' + thisComboBoxIndex).remove();
            if (selectedValue !== '') 
            {
            newComboBox.attr('data-index', newComboBoxIndex);
            newComboBox.attr('id', 'combo' + newComboBoxIndex);
            newComboBox.addClass('parentCombo' + thisComboBoxIndex);
            newComboBox.find('option[value="' + selectedValue + '"]').remove();
            $('#combos').append(newComboBox);
            }
        }
        });
</script>
</html>

What this does is create a new one combobox everytime I fill the combobox before.

What Im looking for is that code create 2 comboboxs everytime I fill the combobox before, instead just one.

How could I do that?

Cheers

  • 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-16T15:07:44+00:00Added an answer on June 16, 2026 at 3:07 pm

    Not sure if this what you want but this adds two combo boxes
    (after $(‘#combos’).append(newComboBox);):

    var otherComboBox = $('#combo' + newComboBoxIndex).clone();
    otherComboBox.attr('id', 'othercombo' + newComboBoxIndex);
    $('body').append(otherComboBox);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: add “readonly” to <input > (jQuery) This is so weird, I hope
Possible Duplicate: How to render a plugin added dynamically? This is my code :
Possible Duplicate: How to add an image in mapview balloon? this is a code
Possible Duplicate: jquery: on vs live I have code that works just fine using
Possible Duplicate: Add row number to this T-SQL query Im using sql server 2008.
Possible Duplicate: How to add .php extension using .htaccess url rewriting? I want to
Possible Duplicate: How can I add resizable widgets in Qt Creator? I am using
Possible Duplicate: how do I add windows phone system colors to icon using expression
Possible Duplicate: add and remove views in android dynamically? In Iphone, the view is
Possible Duplicate: java - How would I dynamically add swing component to gui on

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.