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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:00:54+00:00 2026-05-23T18:00:54+00:00

Consider these two table: <table id=prototype style=display:none;> <tr> <td></td> <td><input type=text ></td> <td><?php echo

  • 0

Consider these two table:

<table id="prototype" style="display:none;">
<tr>
<td></td>
<td><input type="text" ></td>
<td><?php echo date("h:i:s");?></td>
<td><?php echo date("d-m-Y");?></td>
<td>
    <a href="#" class="removeRow"><img width="20px" height="20px" src="images/Remove32.PNG" title="remove" /></a></td>
</tr>
</table>
  <table id="tblGrid" cellspacing="0">
    <tr>
      <th>Instraction</th>
      <th>Result</th>
      <th>Time</th>
      <th>Date</th>
      <th>Add</th>
    </tr>
    <?php do { ?>
      <tr>
        <td><?php echo $row_instRecordset['instName']; ?></td>
        <td><?php echo $row_instRecordset['instValue']; ?></td>
        <td><?php echo $row_instRecordset['instTime']; ?></td>
        <td><?php echo $row_instRecordset['instDate']; ?></td>
        <td><a class="addRow"><img width="20px" height="20px" src="images/add_32.png"/></a></td>
      </tr>
      <?php } while ($row_instRecordset = mysql_fetch_assoc($instRecordset)); ?>
  </table>
  <a class="newOrder">Save</a>

I used this jQuery function to insert new row exactly after clicked row

<script type="text/javascript">
$(document).ready(function(){
        var $prototypeRow = $("#prototype").find("tr").eq(0);
    $(".addRow").click(function(){
        $prototypeRow.clone(true).insertAfter($(this).closest("tr"));
        return false;
    });
    $(".removeRow").click(function(){
        if( confirm('Remove row?') ){
            $(this).closest("tr").remove();
        }
        return false;
    });
});
</script>

This is working fine for insertion, but I encounter a problem in displaying the current time.

It displays the wrong time, and it doesn’t change when I click the insertion button. It repeats the same time and doesn’t “take new read”.

This on third <td> the second <td> contain text input and I want to ask how can I (using jQuery) replacing this text input field with its value after clicking in save 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-05-23T18:00:55+00:00Added an answer on May 23, 2026 at 6:00 pm

    When php script is rendered on the page it will have the static content so dont expect the date will be dynamically changed when you clone the tr element. You will have to update the td inner text/html with current date using javascript date object.

    Try this

        <script type="text/javascript">
            $(document).ready(function(){
                    var $prototypeRow = $("#prototype").find("tr").eq(0);
                $(".addRow").click(function(){
                    var tds = $prototypeRow.clone(true).insertAfter($(this).closest("tr")).find("td"), dt = new Date();
                    tds.eq(1).find("input").val("textInputGoesHere");
                    tds.eq(2).html(dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds());
                    tds.eq(3).html(dt.getDate() + ":" + (parseInt(dt.getMonth())+1) + ":" + dt.getFullYear());
                    return false;
                });
                $(".removeRow").click(function(){
                    if( confirm('Remove row?') ){
                        $(this).closest("tr").remove();
                    }
                    return false;
                });
    
    $('#save').click(function () { 
          $("#tblGrid input").each(function(){
             $(this).replaceWith("<p>" + $(this).val() + "</p>");
          });
    });
            });
            </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider these two classes mapped to the same table. One is readonly via mutable=false.
Consider these two tables: CREATE TABLE GAME_ROUNDS( RoundId int primary key NOT NULL, GameId
Consider these two function definitions: void foo() { } void foo(void) { } Is
I ran across a compilation issue today that baffled me. Consider these two container
Consider these 3 table structures. Which will perform these queries the best. Structure 1
Consider these 2 pieces of code (you can assume execeptionObj is of type Object
Consider these two tables stored in a MySQL database. The first stores a list
Consider these two resources: user and group . Rules: A group is owned by
Consider these two use cases. Say a store gives out store credit for customers.
Consider these classes. class Base { ... }; class Derived : public Base {

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.