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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:16:46+00:00 2026-06-12T00:16:46+00:00

I have an html dropdown : <select name=name1> <option value=1>John</option> <option value=2>Doe</option> <option value=3>Foo</option>

  • 0

I have an html dropdown :

<select name="name1">
<option value="1">John</option>
<option value="2">Doe</option>
<option value="3">Foo</option>
<option value="4">Bar</option>
</select>

Is there a jQuery function that generates the same options but a different dropdown name like:

<select name="name2">
<option value="1">John</option>
<option value="2">Doe</option>
<option value="3">Foo</option>
<option value="4">Bar</option>
</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-06-12T00:16:47+00:00Added an answer on June 12, 2026 at 12:16 am

    Try cloning and changing the name,

    var $newSelect = $('select[name=name1]').clone().attr('name', 'name2');
    

    append/prepend the $newSelect to anywhere in your document 🙂

    Also as David suggested you can dynamically generate the name using below approach,

    var $newSelect = $('select[name=name1]')
                        .clone()
                        .attr('name', function(i,n) { 
                             var int = 
                                    parseInt(n.match(/\d*/),10); 
                             return n.replace(/\d*/, int + 1); 
                         });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

if i have a dropdown with the following html: <select id=myDropdown name=myDropdown> <option value=6>Six</option>
I have this html on a web page: <select name=chapter_select class=chapter_select> <option value=http://www.example.com/chapter/1>Chapter 1</option>
I have this HTML dropdown: <form> <input type=text id=realtxt onkeyup=searchSel()> <select id=select name=basic-combo size=1>
I have this HTML code which simulates a dropdown multi-checkbox <div> <div class=select> <span>Select
I have a <select> drop down that I'm inserting into my HTML via jQuery.
I have multiple dropdown list: @Html.DropDownListFor(x => x.HaveColoSpace.SelectedOptions, new SelectList(Model.HaveColoSpace.Options, Value, Text), new {
I have an editor template with a dropdown: @Html.DropDownListFor(m => m.AdmissionState, new List<SelectListItem>() {
I have created a populated dropdown list in HTML. When the two dropdowns have
I have a webpage written in HTML. I have a dropdown list that is
Consider the following HTML snippet. The desired effect is to have a dropdown be

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.