I am working on a project that involves a selection input with around 5 options. Additionally, there is an empty table that follows this format:
<table>
<tr>
<td>X (for deletion)</td>
<td>Option name</td>
<td>Value linked to the option name</td>
</tr>
</table>
My goal is to dynamically add a new <tr>
element with 3 <td>
each time a user selects an option from the menu. The first <td>
will display an "X" or image for deleting the row, the second <td>
will show the option name, and the third <td>
will have a value linked to that option.
I am looking for guidance on how to create a program that can automatically add the <tr>
and its <td>
s. Additionally, I need help implementing functionality so that when a user clicks on the "X", it deletes the entire parent <tr>
. If possible, I would also like suggestions on how to sum up all values in the 3 <td>
s and display the total on screen.
It's a lot to ask, but if anyone has any insights or solutions, I would greatly appreciate your help. Thank you for taking the time to read this.