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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:50:28+00:00 2026-06-17T04:50:28+00:00

Im using jQuery. $(‘#ranges’).on(‘change’, ‘.combo’, function() { var selectedValue = $(this).val(); var s =

  • 0

Im using jQuery.

$('#ranges').on('change', '.combo', function() {
        var selectedValue = $(this).val();
        var s = $(this).parent("div").attr("class");
        if ($(this).find('option').size() > 2) {
            var newComboBox = $(this).clone();
            var thisComboBoxIndex = parseInt($(this).attr('data-index'), 10);
            var newComboBoxIndex = thisComboBoxIndex + 1;

        $('div.'+s+' .parentCombo' + thisComboBoxIndex).remove();

        if (selectedValue !== '') {
            newComboBox.attr('data-index', newComboBoxIndex);
            newComboBox.attr('id', 'combo' + newComboBoxIndex);
            newComboBox.addClass('parentCombo' + thisComboBoxIndex);
            newComboBox.find('option[val="' + selectedValue + '"]').remove();
            $('div.'+s).append(newComboBox);
        }

});

fiddle

How can I garantee that value before is always higher than next one? May alert user to that issue or turn that combobox_text_value to “red” or prevent user to submit.

At fiddle eg. if I select 2 at first combo I should only select 3 in the next one.

ps: notice me, if you ned more code.

Dynamic combobox handling with values

  • 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-17T04:50:29+00:00Added an answer on June 17, 2026 at 4:50 am

    See working jsfiddle:

    http://jsfiddle.net/JaVVe/22/

    $('body').on('change', '.combo', function() {
        var selectedValue = $(this).val();
    
        if ($(this).find('option').size() > 2) {
            var $newComboBox = $(this).clone();
            var thisComboBoxIndex = parseInt($(this).data('index'), 10);
            var newComboBoxIndex = thisComboBoxIndex + 1;
    
            $('.parentCombo' + thisComboBoxIndex).remove();
    
            if (selectedValue !== '') {
                $newComboBox.data('index', newComboBoxIndex)
                            .attr('id', 'combo' + newComboBoxIndex)
                            .addClass('parentCombo' + thisComboBoxIndex)
                            .find('option')
                .filter(function(){return this.value<=selectedValue && this.value}).remove();
                if($('option',$newComboBox).size() > 1)
                   $('body').append($newComboBox);
            }
        } 
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(using jquery) I have the following function $(function() { $('tr.parent') .css(cursor,pointer) .attr(title,Click to expand/collapse)
using jQuery I have the following code: var selectedIdsArray = $(#selectId option:selected).map(function(){return this.value;}); var
Using jQuery 1.7.2 $(function(){ $('#parentElem').mouseenter(function(){ $('.myElem').animate({opacity:1}, 'fast'); }).mouseleave(function(){ $('.myElem').stop().animate{opacity:0}, 'slow'); }); }); In this
Using jQuery validation - validating on blur: $('input, select, radio, checkbox').blur(function(){ $(#createAccount).validate().element(this); }); If
Using jQuery I'm programmatically generating a bunch of div 's like this: <div class=mydivclass
Using jquery, how can I change the color of these elements to red if
Using jQuery 1.5.1 Tried this block of code in: head section as well as
using jQuery UI 1.9.2 (upgraded from 1.8.23) and I see this on the Upgrade
Using jQuery , I can use the following function to execute code as soon
Using jQuery/jQueryUI I want to populate a form using this HTML/JS show below. The

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.