html collection of elements to array

Solutions on MaxInterview for html collection of elements to array by the best coders in the world

showing results for - "html collection of elements to array"
Ema
04 Oct 2016
1const boxes = Array.from(document.getElementsByClassName('box'));
Tiago
16 Sep 2020
1const boxArray = [...document.getElementsByClassName('box')];
Barack
06 Sep 2018
1var boxes = Array.prototype.slice.call(document.getElementsByClassName('box'));
2
3var boxes = [].slice.call(document.getElementsByClassName('box'));
Laura
09 Apr 2016
1<div class="box"></div>
2<div class="box"></div>
3<div class="box"></div>
4<div class="box"></div>
5
6<script>
7    const boxes = document.getElementsByClassName('box');
8</script>
similar questions
queries leading to this page
html collection of elements to array