Auto increment numbers in div id javascript
问题 can somebody please help me? How to add auto increment number in div ID using javascript? I have four divs and I'd like to have them automatically numbered (box1, box2, box3, box4) in the ID by javascript. Here's my code <div id="box" class="something"> </div> <div id="box" class="something"> </div> <div id="box" class="something"> </div> <div id="box" class="something"> </div> <script> var list = document.getElementsByClassName("something"); for (var i = 0; i <= list.length; i++) { list[i]