I have this table with parent and children folders. I am trying to make the parent's background highlight yellow when it is selected so that it will be easier to know that it is selected. However for some reason (I did not build this) whenever the menu item is clicked on the page is refreshed so the highlighted background goes away. How can I make the background remain highlighted please even after refresh? Thanks alot.
This is my code:
var elems = document.querySelectorAll('.rows');
var fnClick = function(){
var ie = document.querySelectorAll('.rows');
for (var x = 0; x < ie.length; x++) {
elems[x].classList.remove("bg-color");
}
this.classList.add("bg-color");
}
for (var i = 0; i < elems.length; i++){
elems[i].addEventListener("click", fnClick);
}