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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:55:49+00:00 2026-05-27T22:55:49+00:00

I am trying to duplicate a drop down list with jquery. Basically I want

  • 0

I am trying to duplicate a drop down list with jquery. Basically I want when the user clicks a button it will run this and it will remove the value they have selected in the previous drop down box. I am getting my values originally from mySQL.Which then outputs them to a drop down list. When I run this though, the only thing I am getting is the first option I have which is “Select an Interest” in my second drop down list. Can Anyone see why this isn’t working?

Also these are submitted to a form as Arrays hence the square brackets on the name. I am not sure if this is what is causing this but anyones feedback on that is welcome.

Interests<br />
<select name="selectedint[]" id="selectint">
<option selected value="">Select an Interest</option>
<?
for ($i=0; $i<$setintcount; $i++)
{
      if($setinterests[$i] == $interests[$i])
      {
          echo "<option selected value='$setinterests[$i]'>$setinterests[$i]</option>";
      }
      else
      {
          echo "<option value='$setinterests[$i]'>$setinterests[$i]</option>";
      }
}
?>
</select>

<select name="selectedint2[]" id="select">
<option selected value="">Select an Interest</option>
<script>
$('#selectint option').each(function()
{

    $(document).ready(function () {
        if("#selectedint".val() != this)
        {
        document.write(this);
        }
    }
});
</script>
</select>
  • 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-05-27T22:55:50+00:00Added an answer on May 27, 2026 at 10:55 pm

    To copy a dropdownlist and clear the selection you can use the clone method, with removeAttr.

    var newDD = $("#yourDD").clone();
    $("option", newDD).removeAttr("selected");
    

    Check out this fiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a select box drop down with a twist, Basically this
Using the form helper in CakePHP 1.3, I'm trying to display a list (drop-down
Possible Duplicate: CSS Drop Down Menu I am trying to create a drop down
Possible Duplicate: How to make drag-and-drop from one list to another in C#/WindowsForms? I
I'm trying to drop some elements of a list of data in Mathematica, but
I've been trying to get my CSS drop down menu to align with the
I'm trying to duplicate this type of mouse trail. I can't tell if it's
trying to duplicate some PHP code in C#. The PHP code uses the uniqid
We are trying to duplicate one of our informix database on a test server,
I'm trying to duplicate the effect used in the Firefox search box where, if

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.