TransWikia.com

How get item in HTMLCollection?

Magento Asked on October 2, 2021

I have code:

let fieldset = document.getElementsByClassName('fieldset-wrapper');

            console.log(fieldset);

in console log:

HTMLCollection { length: 0 }

when I open collection in console log:

HTMLCollection
​
0: <div class="fieldset-wrapper" data-bind="visible: $data.visible =…l, 'data-index': index}" data-level="0" data-index="general">​
1: <div class="fieldset-wrapper" data-bind="visible: $data.visible =…l, 'data-index': index}" data-level="0" data-index="options_container">
​
length: 2

But when I try to:

console.log(fieldset[0]);

I got an answer ‘undefined’;
How do I get items from a collection? thanks for the answer

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP