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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:13:13+00:00 2026-05-27T14:13:13+00:00

I don’t know where to begin? (textfield A / textfield B) = textfield C

  • 0

I don’t know where to begin?

(textfield A / textfield B) = textfield C

And repeat/clone this table row automaticly .change on keyup of textfield B. Basically meaning that after the first calculation is made, another row will popup with unique ids etc.

<table>
  <tr>
   <td><input type="text" id="A" name="A"></td>
   <td><input type="text" id="B" name="B"></td>
   <td><input type="text" id="C" name="C" value=""></td>
  </tr>
</table>


// Clone table rows
$(function() {
    var i = 1;
    $("#A").clone(function() {
               $("table tr:first").clone(true).find("input").each(function() {
            $(this).val('').attr('id', function(_, id) { return id + i });
            $(this).val('').attr('name', function(_, name) { return name + i });
            }).end().appendTo("table");

        i++;

        $("#C").val(Math.round(($("#A").val() / $("#B").val()) * 100 )+ "%");

    });

});

  • 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-27T14:13:14+00:00Added an answer on May 27, 2026 at 2:13 pm

    I tried hard to understand your question. I have interpreted your question as:

    • On keyup of A or B, calculate A/B, and put the result in C
    • On change of B, add a new row with unique IDs.
    • Continue.

    DEMO: http://jsfiddle.net/vpsv9/

    HTML:

    <table id="math-table">
      <tr>
       <td><input type="text" id="A1" name="A"></td>
       <td><input type="text" id="B1" name="B"></td>
       <td><input type="text" id="C1" name="C" value=""></td>
      </tr>
    </table>
    

    JavaScript:

    // The first requirement
    $("#math-table input").live("keyup", function(){
        var id = this.id.match(/\d+/);
        $("#C"+id).val(  $("#A"+id).val() / $("#B"+id).val()  );
    });
    
    // The second requirement:
    var uniqueIds = $("#math-table tr").length;
    $("#math-table input[id^='B']").live("change", function(){
        var $thisRow = $(this).closest("tr"),
            $clone = $thisRow.clone(),             // Clone row
            $inputs = $clone.find("input").val("");// Reset values, return all inputs
        uniqueIds++; //Increment ID
        $inputs[0].id = "A" + uniqueIds;
        $inputs[1].id = "B" + uniqueIds;
        $inputs[2].id = "C" + uniqueIds;
      //$inputs.eq(0).focus();           // Optionally, focus on the next input field
        $thisRow.after($clone);                    // Add row after current one
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

don't know if this is possible.. I'm using sqlite3 schema: CREATE TABLE docs (id
Don't know if I worded the question right, but basically what I want to
(Don't know if this is strictly on-topic, but I don't see any better Stack
Don't know if this has been asked before, so point me to another question
Don't know if anyone can help me with this or if it's even possible.
I don't know: if this works. if it's a good idea. what it is
I don't know if this question is trivial or not. But after a couple
Don't know if this is the right place to ask this, but I will
Don't know what to do with this error. How to add data in SQL
Don't know if this is an eclipse specific problem but whenever I declare 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.