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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:18:12+00:00 2026-05-19T00:18:12+00:00

I decided to use jquery to create the duplicate of dropdown menus instead of

  • 0

I decided to use jquery to create the duplicate of dropdown menus instead of using my perl script. I have come to an issue.

I have a series of drop boxes that I clone multiple times. The structure is like this:

<div id="org_dropmenus_asdf">
    <table border="0">
    <tr>
    <td valign="top">
        <select name="wimpy_asdf_1" id="wimpy_asdf_1" size="4">
          <option value='1'>1</option>
          <option value='2'>2</option>
        </select>;
    </td>
    <td valign="top">
        <select name="monkey_asdf_1" id="monkey_asdf_1" size="4">
          <option value='c'>c</option>
          <option value='d'>d</option>
        </select>;    
    </td>
            </tr>
            </table><p>
    </div>|;

I clone var $cloneDiv = $(‘#org_dropmenus_asdf’).clone();

How can search and replace the asdf_1 (“1”) and increment with new 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-05-19T00:18:13+00:00Added an answer on May 19, 2026 at 12:18 am

    You need to do something along the lines of this:

    var counter = 1;
    $cloneDiv = $('#org_dropmenus_asdf').clone().find('[id]').attr('id', function(idx, oldId){
        return oldId.substr(0, -1) + counter;
    }).attr('name', function (idx, oldName) {
        return oldName.substr(0, -1) + counter;
    });
    

    You could do this repeatedly, incrementing counter each time. Note that this code will only work up to 9, because it removes the last character; more characters need to be removed above 10.

    Note also that this doesn’t change the org_dropmenus_asdf id attribute, which also needs to be changed for a valid DOM.

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

Sidebar

Related Questions

I've been developing a site using ASP.NET MVC, and have decided to use the
I decided to use the JQuery UI Datepicker script for picking dates. Below is
I've decided to give Dojo a shot instead of using JQuery for once, and
I have a form whitch divided into a few divs . I use jquery
I have a application built using Zend Framework. I have decided to go with
I decided to use jquery-ui Autocomplete Combobox, but until now I didn't noticed that
I'm using Rails with the JQuery plugin, and have some really complicated validations for
I've decided to create a web based chat system for the experience. I'm using
I decided to use log4net as a logger for a new webservice project. Everything
We decided to use the minimumRequiredVersion in our clickOnce application manifest, and now when

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.