0

What should be the js code for auto increment row in html table by pressing the enter?

html table for cost, price & profit

16th Nov 2017, 5:59 PM
Napster
Napster - avatar
4 Answers
+ 1
Can you describe what you want more clearly? Are you looking for values in the table to change, rows of table to be added, etc? Show initial state and finished state so we can understand what you are looking for.
16th Nov 2017, 6:23 PM
John Wells
John Wells - avatar
+ 1
I am also beginner and the above code is approximate. (The code editor is not working) addEventLinstener("keydown", function (event) { If (event.keyCode === */codeEnterButton /*) { const row = document.getElementById("rowInTable"); let newRow = row.cloneNode(); const table = getElementById("table"); table.appendChild(newRow); } }
16th Nov 2017, 6:26 PM
Š˜Š²Š°Š½ Š˜Š²Š°Š½Š¾Š²
Š˜Š²Š°Š½ Š˜Š²Š°Š½Š¾Š² - avatar
+ 1
Another method is how I did my program here: https://code.sololearn.com/W0SpGiJ3Vfzb/?ref=app I use a button to get there, but instead of the cloning of the row, I add the new items. onchange="function" on your cells could pick up table entry changes to auto-calculate updates. This program uses an entry being edited to do that: https://code.sololearn.com/WK1Jvq3HBMyr/?ref=app
17th Nov 2017, 12:24 PM
John Wells
John Wells - avatar
0
I have a html table under the column heading of cost, price & profit. cost= 250, Price=325, profit=?. <enter for new line> all I want that, after auto calculation of profit when I hit enter key is should gave me a new row in very same table. I am a fresher & on a project.
17th Nov 2017, 5:30 AM
Napster
Napster - avatar