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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:47:52+00:00 2026-06-17T04:47:52+00:00

This is my code $(function() { $( .datepicker ).datepicker(); }); This Code is genrating

  • 0

This is my code

 $(function() {
    $( ".datepicker" ).datepicker();
    });

This Code is genrating extra text feilds:

<script type="text/javascript">
   var counter = 0;
function add_user1(FieldName) {
counter++;
var newFields = document.getElementById(FieldName).cloneNode(true);
newFields.id = '';
newFields.style.display = 'block';
var newField = newFields.childNodes;
for (var i=0;i<newField.length;i++) {
var theName = newField[i].name
if (theName)
newField[i].name = theName + counter;
}
var insertHere = document.getElementById(FieldName);
insertHere.parentNode.insertBefore(newFields,insertHere);
}
</script>

But this part of html working perfect, but when I click on add more fields the datepicker doesn’t work.

                **<label id="l" style="width:120px;">Employment History:</label>
                <br class="clear"/>
                <label id="l" style="width:80px;">Role:</label>
                <input id="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_role[]"/>
                <br class="clear"/>
                <label id="l" style="width:80px;">Company:</label>
                <input id="l" type="text" size="37" onblur="" value="" style="width:auto;" name="user_com[]"/>
                <br class="clear"/>
                <label id="l" style="width:80px;">From:</label>
                <input class="datepicker"  type="text" size="37" onblur="" value="" style="width:auto;" name="user_from[]"/>
                <br class="clear"/>
                <label id="l" style="width:80px;">To:</label>
                <input class="datepicker"  type="text" size="37" onblur="" value="" style="width:auto;" name="user_to[]"/>
                <br class="clear"/>**

It is viewing jquery calender but when i put it in this particular div the date picker doesn’t work

                **<div id="add_user1" style="display: none;" >**
<label id="l" style="width:80px;">Role:</label><input id="l" type="text" size="37" style="width:auto;" name="user_role[]" value="" /><br class="clear"/>
<label id="l" style="width:80px;">Company:</label><input id="l" type="text" size="37" style="width:auto;" name="user_com[]" value="" /><br class="clear"/>
<label id="l" style="width:80px;">From:</label><input class="datepicker" type="text" size="37" onblur="" value="" style="width:auto;" name="user_from[]" /><br class="clear"/>
<label id="l" style="width:80px;">To:</label><input class="datepicker"  type="text" size="37" onblur="" value="" style="width:auto;" name="user_to[]"/><br class="clear"/></div>
<input type="button" id="add_user1()" onclick="add_user1('add_user1')" name="btn" value="Add More!" /><br>
                <br class="clear"/>
               <!---------Dyanmic Fields ---------->
  • 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-17T04:47:53+00:00Added an answer on June 17, 2026 at 4:47 am

    You should just need to call .datepicker(); on the new fields after they’re created.

    var counter = 0;
    function add_user(FieldName) {
      counter++;
      var newFields = document.getElementById(FieldName).cloneNode(true);
      newFields.id = '';
      newFields.style.display = 'block';
      var newField = newFields.childNodes;
      for (var i=0;i<newField.length;i++) {
        var theName = newField[i].name
        if (theName)
          newField[i].name = theName + counter;
      }
      var insertHere = document.getElementById(FieldName);
      insertHere.parentNode.insertBefore(newFields,insertHere);
    
      $(newFields).find('.datepicker').datepicker();
    }
    

    There is also a typo on your button’s click event: Change the function from add_user1('add_user1') to add_user('add_user1')

    Working fiddle demo: http://jsfiddle.net/Rykus0/xTqvC/

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

Sidebar

Related Questions

if i put this code to show jquery datepicker : <script type=text/javascript> $(function ()
Currently I have this javascript code for my date picker <script type=text/javascript> $(function() {
I have this code, but now i am stuck: <input type=text id=datepicker value=/> <script
becouse textboxes are stored in viewstate i cannot use this JS code <script type=text/javascript>
I have this code currently: $('#cal').datepicker({ onSelect: function(dateText, inst) { var dateAsString = dateText;
<script type=text/javascript> $(function () { $(#slider-range).slider({ range: true, min: 0, max: 100, values: [25,
I have got this code: function init(){ if (typeof window.jQuery !== 'function') { var
I got this code: function zeroPad(num, places) { var zero = places - num.toString().length
Hello I get a weird error in this code: function validateForm(aform) { var s=;
I have this code: _trackit: function(){ for(var key in this.items.sublinks){ switch(key){ case 'shoes': for(var

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.