Thanks to Google I have been a skilled copy-paste-javascript-coder. That means I get it sometimes to work, but I have no clue why 😆 .
I search for a solution to select a entire row in a table. I found this:
“`
var select = table.getElementsByClassName(‘select’)
table.addEventListener(‘click’, function(event) {
if (select[0]) select[0].className = ”;
const row = event.target.parentNode;
row.classList.add(“select”)
});
Works almost perfect, but this row I need some explanation:
`if (select[0]) select[0].className = ”;
I guess that this deselects selected rows. By iteration or not.
Can anybody explain what happens? What is this row called? How does it work behind the code?