0
What should be the js code for auto increment row in html table by pressing the enter?
html table for cost, price & profit
4 Réponses
+ 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.
+ 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);
}
}
+ 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
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.