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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:20:47+00:00 2026-05-27T15:20:47+00:00

I need to have a datetimepicker to popup onclick of the date input fields,

  • 0

I need to have a datetimepicker to popup onclick of the date input fields, the date pickers are defined in a javascript function like this:

  function loadcalendar(){
   jQuery(function() { 
                            $('#ar_startdate').datetimepicker({ 
                                dateFormat: 'yy-mm-dd',
                                showSecond: true,
                                timeFormat: 'hh:mm:ss'
                              });
                            $('#ar_enddate').datetimepicker({ 
                                dateFormat: 'yy-mm-dd',
                                showSecond: true,
                                timeFormat: 'hh:mm:ss'
                             });
          });
 } 

now I am calling load calendar when I populate the input fields into table row dynamically just after they are appended as rows to a table
Something like this:

// when a image in table_newrole is clicked the input fields are appended as a row in table_rolecart, below is the js code
 $(document).ready(function() {
    $("#table_newrole img.move-row").live("click", function() {
     $("#table_rolecart tbody").append('<tr><td>Start Date: <input type="text" value="" id="ar_startdate"></td><td>End Date: <input type="text" value="" id="ar_enddate </td></tr>');
   loadcalendar();

With the above setup the datepickers get displayed only in first iem as right all input text fields share the same id, so how do I create an id from an index and associate each with the datepicker after that row is appended .
Regards,
Priyank

  • 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-27T15:20:48+00:00Added an answer on May 27, 2026 at 3:20 pm

    Make sure you always have only 1 element with certain ID. If you’re going to add several rows, you need to use classes instead. Try this:

     function loadcalendar(){
           $('.ar_startdate:not(.parsed)').datetimepicker({ 
               dateFormat: 'yy-mm-dd',
               showSecond: true,
               timeFormat: 'hh:mm:ss'
           }).addClass("parsed");
           $('.ar_enddate:not(.parsed)').datetimepicker({ 
               dateFormat: 'yy-mm-dd',
               showSecond: true,
               timeFormat: 'hh:mm:ss'
           }).addClass("parsed");
     } 
    // when a image in table_newrole is clicked the input fields are appended as a row in table_rolecart, below is the js code
     $(document).ready(function() {
         $("#table_newrole img.move-row").live("click", function() {
             $("#table_rolecart tbody").append('<tr><td>Start Date: <input type="text" value="" class="ar_startdate"></td><td>End Date: <input type="text" value="" class="ar_enddate </td></tr>');
             loadcalendar();
         });
     });
    

    I’ve added .parsed to check if input had already been converted. I don’t know what does the plugin you’ve chosen, but just in case. Anyway there are other ways to achieve this same thing such as:

     var config = {
         dateFormat: 'yy-mm-dd',
         showSecond: true,
         timeFormat: 'hh:mm:ss'
     };
     var newRowAndBind = function(){
         var row = $('<tr><td>Start Date: <input type="text" value="" class="ar_startdate"></td><td>End Date: <input type="text" value="" class="ar_enddate </td></tr>');
         row.find(".ar_startdate").datetimepicker(config);
         row.find(".ar_enddate").datetimepicker(config);
         row.appendTo("#table_rolecart tbody");
     };
     $(document).ready(function() {
         $("#table_newrole img.move-row").bind("click", newRowAndBind);
     });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have columns defined like this: <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBox Text={Binding Path=COLUMN_NAME, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}
I need to have a DateTimePicker which will be able to select the Time
I have need to pack four signed bytes into 32-bit integral type. this is
I have need for a function pointer that takes two arguments and returns a
I need to have the URL like photos/13/rate => I have created following routing
This is what I need - have a key that will create ctags of
I have need for a system function call, the same as those in Python,
I have a javascript datetimepicker that I downloaded online which I use to select
I have a date picker ( DateTimePicker ) in my application. Currently, when a
I'm have a Windows Form with 2 datetimepicker controls: one for date and a

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.