Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Adding a feature to a practice project

Hi.

Im trying to build some kind of tool manager. so far all the functionallity is working.

I want to add an history log feature. if u look at the project i have 1 table that is for the taken tools and i created another table for the history.

What i want to do is when i press the X button, I want to get the specified row that i clicked on and insert it into the history table with the time that i returned the tool.

so far this is what i did: current snapshot: https://w.trhou.se/mdk9oeeol9

I basically want to take this lines from the table with the inputs from the users:

  row.innerHTML = `
            <td><input value="${tool.name}" disabled/></td>
            <td><input value="${tool.toolName}" disabled/></td>
            <td><input value="${tool.number}" disabled/></td>

and insert only this td tags to the second table(To the history-list table)

so far what i did, is this:

             const historyList = document.querySelector("#history-list");
                 const historyRow = tr.innerHTML;

i selected the history-list table and i stored the tr element with the userinput inside historyRow before i removed it so the data of the removed item will be saved.

i dont have the full way for solving it by if i console.log the historyRow i get this:

            <td><input value="tool one" disabled=""></td>
            <td><input value="scissors" disabled=""></td>
            <td><input value="20" disabled=""></td>
             <td><a href="#" class="btn btn-danger btn-sm delete">X</a></td>
             <td><a href="#" class="btn btn-danger btn-sm edit">Edit</a></td>
             <td>22.7.2019, 22:51:19</td>

so i thought i can select all the td tags like that:

const something   =  parentRow.querySelectorAll("TD");

and then loop through all of the array and somehow extract only the items i want to but it didnt worked..

I will really really appreciate any insights,help.

Steven Parker Fernando Boza

1 Answer

**UPDATE**

I Managed to do it by my own at the end!!! :} I'm so excited! if u intersted to see how i implemented it, this is the current snapshot: https://w.trhou.se/wnwqx23m8x