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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:48:40+00:00 2026-06-05T18:48:40+00:00

I have several Select which depend on each other if I select a value

  • 0

I have several Select which depend on each other if I select a value in one of the other is removed, and the previous value is added to others, how I can add the previous value by JQuery to Select? and then sort it alphabetically?

  • 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-05T18:48:42+00:00Added an answer on June 5, 2026 at 6:48 pm

    Not sure about the sorting (shouldn’t be too hard to figure out) but you can append an <option> element to a list like this:

    $("#myselect").append(
        $("<option>").prop("selected", "selected").attr("value", "OptionValue").text("OptionText")
    );
    

    The first call to prop() is only if you need the element to be the selected one in the list, otherwise you can omit it.

    Edit: I went ahead and worked out the sort part:

    var elems = [];
    $("#sortable > option").each(function () {
        elems.push({ key: $(this).val(), value: $(this).text() });
    });
    
    elems.sort(function (a, b) {
        if (a.value < b.value) return -1;
        if (a.value > b.value) return 1;
        return 0;
    });
    
    $("#sortable").empty();
    $.each(elems, function (idx, item) {
        $("#sortable").append(
            $("<option>").attr("value", item.key).text(item.value)
        );
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model Question which can have several Answer instances, each one with
I have a DataTable which I select from database (Well, these data cross several
I have several statements which access very large Postgresql tables i.e. with: SELECT a.id
I'm using an e-commerce system which allows you to have several variations for each
I need to create a GUI, using which users can select several attributes which
I have several nodes (see below). I know how to select specific nodes which
I have several select tags on a page and I am grouping them using
I am using MySQL. I have several lookups like this: SELECT * from users
Say I have a stored procedure consisting of several separate SELECT, INSERT, UPDATE and
I have... a dynamic populated select box several input boxes a submit button form

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.