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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:56:26+00:00 2026-06-17T17:56:26+00:00

I am using jquery datepicker in a quote building page. The page duplicates a

  • 0

I am using jquery datepicker in a quote building page.
The page duplicates a hidden table row every time you click to add a row.

Unfortunatelly for the 3rd and subsequent rows when you use the datepicker (which appears fiine) the date is entered into the second row not the row selected.

Using firebug I’ve determined that the date field input for each subsequent row is being given the same id as the second row. This is because the template row that is cloned for each ‘added row’ is already present when I load the page.

Has anyone got any pointers as to how I can get around this problem.

Jquery:

$(document).ready(function(){
    refreshDatepickers();
    $('#additem').click(function(){
        addItem();
        refreshDatepickers();
        return false;
    });


function addItem(){
    var itemRow = $('#rowtemplate');
    var newRow = itemRow.clone().removeAttr('id');
    newRow.appendTo($('.newQuote tbody'));
    newRow.attr('id', 'item_'+(newRow.siblings().length+1));
    return false;
}

function refreshDatepickers(){
    var tobeDated = $('.datepicker');
    $.each(tobeDated, function(){
        $(this).removeClass('hasDatepicker').datepicker({dateFormat: "dd/mm/yy"});

    });
}

The simplified html for the row that is duplicated for each new row is as follows:
The datepicker iinput gets this kind of id added on the fly (by the datepicker plugin I’m assuming)
id=”dp1358783794011″

 <div style="display:none;">
<table>
    <tr id="rowtemplate">
        <td><input type="text" class="qi-name" name="items[title][]"/></td>
        <td><textarea class="qi-desc" name="items[description][]"></textarea></td>
        <td><input type="text" class="qi-del datepicker" name="items[delivery][]"/></td>

        <td class="qi-act">
                <a href="#" class="actAs qi-apply"></a>
                <a href="#" class="qi-delete"></a>
        </td>
    </tr>
</table>

  • 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-17T17:56:27+00:00Added an answer on June 17, 2026 at 5:56 pm

    Suggest caching your row template before running any other code, then add clone of the cached row when adding a new row

    /* remove ".find(':input').val('').end()" if no data will be populated at run time*/
    var cacheRow=$('#rowtemplate').clone().removeAttr('id').find(':input').val('').end();
    
    /* run init code*/
    
    function addItem(){    
        var newRow =cacheRow.clone();
        newRow.appendTo($('.newQuote tbody'));
        newRow.attr('id', 'item_'+(newRow.siblings().length+1));
        return false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the jquery datepicker with the timeplugin. This works on every browser
I am using jquery mobile datepicker, i need to capture the calendar click event,
I've been using the jQuery datepicker quite successfully for some time now. But, since
I an using JQuery datepicker on my asp.net page and I can't see Prev
I am using jquery datepicker, please see below code $(document).ready(function() { $(.txtDate).datepicker({ showOn: 'button',
I'm using jQuery Datepicker but I'm having trouble when editing records. // js code
I am using jquery datepicker for my application. I want to highlight the dates
I'm using jQuery widgets DatePicker and Dialog to interact with fullCallendar by Adam Shaw
I am using the jquery datepicker ( http://jqueryui.com/demos/datepicker/ ). The datepicker on the demo
I am using the jQuery datepicker on a text input field and I don't

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.