This is the line that gives me the error:
var modalList = document.getElementsByClassName("modal") as HTMLCollectionOf<HTMLElement>;
This was based off a HowTo tutorial found here, but my page will have multiple modal images so I changed a few things. I found many examples of casting the return value of .getElementsByClassName
to HTMLCollectionOf<HTMLElement>
, which is necessary in my case since I will be accessing some of the properties later. If most other examples work, why won't this one? My script tag is at the bottom of the body.