Hi,
I’m new to Javascript, it’s my first project on it.
I need to build a website with 80 row and 5 columns which I did on HTML. Now for the last column for each row, I need to be able to press a button that will disappears, show me 3 differents buttons and show input on each column to replace the data of the line. One button will be to enter the modification, the other to delete the row and the last one to cancel the operation. Also, I need to be able to do that on every new row that I add.
I’m completely lost because in my head I need to make a function for each line and associate an id for each line to do that. Sorry if I’m not explaining the problem very well but I have been stuck for hours on this problem.
Hopefully someone can help me.
Thanks you, and if you need more information or want to call me stupid, just do!
I tried hiding a button and make another one appear with this:
function afficherBtn()
{
document.getElementsByClassName("showBtn").innerHTML = "";
document.getElementsByClassName("hiddenValider").style.display = 'block';
}
But it doesn’t seem to work.
Also, I just don’t know how to only specify the row I want to change, that’s my big problem right now. Like only make the modify button on row 5 modify row 5 things.
You can simply use a selector for that, a unique ID, a data attribute, or select the element through the event.
It all depends on you.
If they have an identifier you can then perform any action only on that.
But this is just a suggestion, there are other methods to achieve the same goal
Thanks you, it works!
But now when I press Cancel I want to hide the new button and bring back modify, but I’m not able to select the input and make it appear. This is what I tried:
HTML:
previousStringElement doesn’t work in that case, because what I’m trying to bring back is the modify button which is not the direct previous element. I’m still stuck.
Well I tried your method that you posted yesterday, but for some reason the selectors doesn’t seem to work. When I press modify nothing happens.
Javascript: