JS-function on array
Hey so, I've got an array and I need a listener on it that'll always be listening
It has to run a function, using the index of the element within the array its been clicked on (As it would have to delete the element including its siblings and its parentElement
However, I cannot put an addEventListener on the raw array it seems, this is what I've got:
As a sidenote, this function will have an array of [] in the beginning, as no elements will have that className yet (I figured to use getElementsByClassName as its dynamic and not static and the array can get longer and shorter, if one is deleted obv it'll get shorter if ones added itll get longer)
The error in the console is:
It has to run a function, using the index of the element within the array its been clicked on (As it would have to delete the element including its siblings and its parentElement
However, I cannot put an addEventListener on the raw array it seems, this is what I've got:
As a sidenote, this function will have an array of [] in the beginning, as no elements will have that className yet (I figured to use getElementsByClassName as its dynamic and not static and the array can get longer and shorter, if one is deleted obv it'll get shorter if ones added itll get longer)
The error in the console is:
