I have a list with registered items and one of the attributes of this item is a button to delete that item.
By clicking on the button I want to know the position of the line clicked inside the list.
When I know the position, I'll delete the same value from the array as posição[i]
removeLinha(element){
//Aqui eu obtenho a 'tr' clicada
let trash = element.parentNode.parentNode;
//Aqui eu removo;
trash.parentNode.removeChild(trash);
}
But before removing I need to know the position of <tr>
within <tbody>
to delete in array too.