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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:06:49+00:00 2026-05-13T17:06:49+00:00

Suggestions other that dumping IE6 that is… I can’t control that :) Quick synopsis

  • 0

Suggestions other that dumping IE6 that is… I can’t control that 🙂

Quick synopsis of what I am trying to do: I have a form with select elements. When the user selects a specific option in the select (id type2 in the code below), I display a div structure that contains a new select. I want the new div structure and its children to be a clone of an existing one (id pdProgramDiv1) because I use php to populate the select in the div. Once the select is cloned, I need to change the clone’s id and name of the div and its child label and select because the form information is getting passed to my submit php script. If they don’t have unique ids, then although they are serialized into the query string, the $_POST array in php only includes the last value of a given id.

I have included the code that works absolutely perfectly in Firefox sigh, and fails to change the ids and names in IE6. This code may not be as concise as some; I am still pretty new to jQuery.

$('#type2').change(function() {
    if ($('#type2 option:selected').text() == 'Program Director') {
        $('#pdProgramDiv1').clone().attr({id: 'pdProgramDiv2', name: 'pdProgramDiv2'}).appendTo($('#type2Div'));

        $('#pdProgramDiv2 > #pdProgram1').attr({id: 'pdProgram2', name: 'pdProgram2'});

        $('#pdProgramDiv2 > label').attr('for', 'pdProgram2');
    } else {
        $('#pdProgramDiv2').hide();
    }
}); 

I have looked around, and tried using variables rather than chaining, and individual calls to attr rather than using the object literal (or map), but nothing helps. All the variations work fine in FF, but no joy in IE6.

Is this a known problem, or can anyone tell me way to make the changes happen?

If I can’t get this to work, I guess I will have to create all the elements and hide them, but that doesn’t seem as good.

Thanks in advance as always!

UPDATE: SOLVED

Thanks so much to the folks that found the error of my ways. I wanted to post the code that ending up solving the problem. As I said in my comment to the accepted answer below, the fix makes perfect sense. A little embarassed I didn’t see it, but sometimes a fresh pair of eyes is needed! The only change is with selecting the child select rather than the select ID, and removing the name attr assignment on div, because as mentioned, it does nothing.

$('#type2').change(function() {
    if ($('#type2 option:selected').text() == 'Program Director') {
        $('#pdProgramDiv1').clone()
            .attr('id', 'pdProgramDiv2')
            .appendTo($('#type2Div'));

        $('#pdProgramDiv2 > select').attr({
             id: 'pdProgram2', 
             name: 'pdProgram2'});

        $('#pdProgramDiv2 > label').attr('for', 'pdProgram2');
    } else {
        $('#pdProgramDiv2').hide();
    }
}); 
  • 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-13T17:06:49+00:00Added an answer on May 13, 2026 at 5:06 pm

    I think you problem is here…

    $('#type2').change(function() {
        /* snip */
            $('#pdProgramDiv1').clone().attr({id: 'pdProgramDiv2', name: 'pdProgramDiv2'}).appendTo($('#type2Div'));
    
            $('#pdProgramDiv2 > #pdProgram1').attr({id: 'pdProgram2', name: 'pdProgram2'});
        /* snip */
    });
    

    You’re cloning the container, switching it’s ID, and inserting it back into the page. The containers are fine, but the page now cotnains two elements ID’d #pdProgram1. document.getElementById is not going to like that.

    Refactor the code to search for the select element by its tag instead of by its ID.

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

Sidebar

Related Questions

I have a batch file that I have been using to install my C#
I have an external Windows .exe that is actually Java application: Running the .exe
I have a C# application that allows one user to enter information about customers
I have a referral project. In that there is an agent between the affiliate
I have a few SortedList<> and SortedDictionary<> structures in my simulation code and I
I have a dictionary which has coordinate pairs as a keys: i.e.: d =
I'm deploying an early bound styled VBA module that needs Scripting.Dictionary and RegExp .
I am planning on writing a medium size web application that will be XML
A rather simple question really. I'm working on a project where I need to
I'm using GD to generate images on the fly for title images on 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.