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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:51:21+00:00 2026-05-28T05:51:21+00:00

I am printing a form in a row on a page. The row contains

  • 0

I am printing a form in a row on a page. The row contains a few columns which hold the form elements. Much like a table but in CSS.

When the user clicks on a link with the ID add_transaction_row then a little bit of jQuery is called which appends another row/div to the page. This row contains an identical set of div’s and form elements as the row above.

I have named the elements date[], sub_cat_id[] etc so that I get an array of the updates to process on the next page.

I am using the jQuery datepicker for the date input box. I have a trigger on on class called .datepicker.

On the first row the jQuery date picker appears as expected. However when I click into any of the date input boxes on the rows below (the new rows/input box’s added by jQuery append) then the datepicker does not work.

I was thinking that it might be something to do with me naming them all the same so I have given them all a unique ID. Still no luck.

I am now thinking its something to do with jQuery adding the .datepicker on page load and then when I click the bottom to add a new row this is adding the html to the source but after jQuery datepicker has loaded so it does not pick the new date/input box’s up?

If anyone could shed any light on this I would appreciate it.

<?php

    $my_new_split = '';
    $my_new_split .= '<div class="split_transaction_box">';
    $my_new_split .= '<div class="span-7">' . form_input('date[]', '', 'id="' . random_string('numeric', 8) . '" class="datepicker"') . '</div>';
    $my_new_split .= '<div class="span-7">' . form_dropdown('sub_cat_id[]', $subcategories_options) . '</div>';
    $my_new_split .= '<div class="span-5">' . form_input('reference[]') . '</div>';
    $my_new_split .= '<div class="span-4 last">' . form_input('ammount[]') . '</div>';
    $my_new_split .= '<div class="clearfix"></div></div><!-- /.split_transaction_box -->';

    $my_new_split = trim($my_new_split);

    $replace_this   = array("\r\n", "\n", "\r");
    $my_new_split = str_replace($replace_this, '', $my_new_split);

    $my_new_split = str_replace('"', '\"', $my_new_split);

?>

<script>

    $(document).ready(function() {

        $('#add_transaction_row').click(function() {
            $(".split_continer").append("<?=$my_new_split;?>");
            return false;
        });
    });

</script>

<hr />

<div class="span-24 last">

    <?=form_open('accounts/do_split')?>

    <div class="split_continer">

        <div class="split_transaction_box">

                <div class="span-7"><?=form_input('date[]', '', 'id="' . random_string('numeric', 8) . '" class="datepicker"');?></div>
                <div class="span-7"><?=form_dropdown('sub_cat_id[]', $subcategories_options);?></div>
                <div class="span-5"><?=form_input('reference[]');?></div>
                <div class="span-4 last"><?=form_input('ammount[]');?></div>


            <div class="clearfix"></div>
        </div><!-- /.split_transaction_box -->

    </div><!-- /.split_container --> 

    <br />
    <a href="#" class="button" id="add_transaction_row">Add new split</a>
    <input type="submit" class="button white" value="Save this split" />

    <?=form_close()?>
  • 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-28T05:51:21+00:00Added an answer on May 28, 2026 at 5:51 am

    Your exactly right, the datepicker does not work on new elements because you are adding those elements into the page after jquery has attached the datepicker. I’ve come across this issue myself. I came up with a few ways of doing it.

    The first way was to bind a live click handler to the element, check if datepicker is applied, and if not apply it.

    http://jsfiddle.net/uyx67/1/

    But maybe a better way is to build the elements using jquery as objects and apply the datepicker that way

    http://jsfiddle.net/4jmkw/3/

    Both ways work, and do the job.

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

Sidebar

Related Questions

We have a high-resolution PDF (for printing) which has some form fields on it.
When printing a page from a browser, it refers to a print.css stylesheet declared
I am printing an invoice from a winforms form. All is great. But I
I have a form that I want a separate CSS file for printing. On
I am trying to do a form feed & skip 1 page while printing,
i have a form, which upon submission needs to refresh the page with a
I need to develop a simple form (intended only for printing) to be filled
My server receives multipart form data from a mobile app. The result of printing
Why is this printing out 0 back in main but 6 when it is
The javascript is printing out the HTML onto the page example below, is it

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.