0

I have a list of svg objects with a certain class name 'test'.

list = document.getElementsByClassName('test')

I want to find the index of an object in the list (e.target) when it is clicked via an event listener. But it's freezing up.

The smallest example that gives an error would be the following:

list.indexOf(list[1])

which should return 1 but doesn't. I think the problem is that getElementsByClassName gives an "array-like" list, not an actual array. But I can't figure out how to get by it.

Chrystomath
  • 127
  • 4

0 Answers0