HTMLCollection appearing in console with many elements but has length 0

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 00:00:32

You need to do document.getElementsByClassName('te-s') after the calendar is loaded.

The 32 you are seeing before is correct. It is showing you object of HTMLCollection which is reference to the array. So when the eventToClick is printed, it has zero values in it .. put a debugger and see it. But after the calendar is loaded the eventToClick is showing you all the values. The reason why the length is 0 is same. The length shown is pass-by-value. So when you requested it, the length was actually 0.

There must be some callback function after the calendar is loaded which you can use to get the correct value, you can get correct length over there.

If you need help in this let me know the calendar library you are using, would love to research on it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!