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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:07:12+00:00 2026-06-15T23:07:12+00:00

The fieldset in now cloning without retaining data from the previous fieldset as I

  • 0

The fieldset in now cloning without retaining data from the previous fieldset as I intended. Thank you RobG and ATOzTOA for all your help.

The only problem I’m having now is the calendar is nonfunctional in the cloned fieldsets.

I have looked through several threads where people have had the same problem as me and I apologize for creating another thread on the subject.

Script for calendar dropdown.

<!-- calendar dropdown -->
<script>
$(document).ready(function() {    
$("#datepicker").datepicker();      
});    
</script>     

Script to clone the fieldset.

<!-- clone fieldset -->          
<script>
var _counter = 0;
function Add() {
_counter++;
var oClone = document.getElementById("template").cloneNode(true);
oClone.id += (_counter + "");
document.getElementById("placeholder").appendChild(oClone);
var inputs = oClone.getElementsByTagName('input');
for (var i=0, iLen=inputs.length; 
i<iLen; i++) {
inputs[i].value = '';
}
}
</script>

Fieldset to be cloned.

<div id="placeholder">
<!-- template -->
<div id="template">
<!-- event fieldset -->
<fieldset>           
  <label class="field-first" required>Event: &#42;<input type="text" name="event" value="" /></label>
  <label class="field-first" required>Date: &#42;<input type="text" id="datepicker" name="date" value="" /></label>
  <label class="field-first" required>Net Request Amount: &#42;<input type="text" name="request" value="" /></label>

  <div class="description"><p>Please type a <strong><em>DETAILED</em></strong> description of the item/event/activity:<br /></p></div>

  <textarea name="describe" cols="60" rows="10" required></textarea>
<!-- event fieldset -->
</fieldset>
<!-- template -->      
</div>
<!-- placeholder -->
</div> 
<!-- buttons -->
<button class="right-button" type="submit" name="submit" value="Submit">Submit</button>
<button class="left-button" "btn" type="button" name="Submit"  onclick="Add();">Add New Event</button>
  • 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-15T23:07:13+00:00Added an answer on June 15, 2026 at 11:07 pm

    Presumably you are adding content to the labels. You can use getElementsByTagName to get the labels from the clone, then set their innerHTML to ” (empty string) to remove any child nodes (or loop over the child nodes and remove them, but setting the innerHTML property is simpler). While looping over the labels, you can modify any other properties that might need it.

    If you just want to clear the value of the input elements, same strategy only use getElementsByTagName('input') and set their value property to “ (empty string).

    Note that you have three input elements with a name of “first_name”. It doesn’t seem like a good idea to do that when none of them seems to be a first name. Use a name that represents the data they hold or the purpose to which it will be put. It also doesn’t seem to be necessary to have one with an ID of “datepicker”. Either remove the ID, or if you need it (unlikley), modify the value so it’s unique to each cloned fragment.

    Edit

    To use getElementsByTagName to set the input values to “”:

    var inputs = oClone.getElementsByTagName('input');
    
    for (var i=0, iLen=inputs.length; i<iLen; i++) {
        inputs[i].value = '';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is it possible to create subform and displaygroup without fieldset on zend forms?
I am using FieldSet element in my web application. Now I need to apply
We are using fieldset in our application using extjs3.Now we are moving forward to
Following on from my previous question , which was so quickly answered by Meder
I have a DB like this that I generated from EF: Now I'd like
i got the error DEPRECATION WARNING: error_messages_for was removed from Rails and is now
Basically, I have correctly followed different tutorials. Now, my models are taken from a
So I have a Radio button group, like so: <div data-role=fieldcontain> <fieldset data-role=controlgroup> <legend>Choose
I have a fieldset in which I have some input fields and a checkbox.
I have defined a fieldset in HTML, and applied the following (simple) CSS rules

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.