S
S
Smeecy Smeecy2021-07-02 17:29:39
JavaScript
Smeecy Smeecy, 2021-07-02 17:29:39

How to load 4 objects?

I have an array of 24 objects, but only the first 8 are displayed, the rest should be loaded in 4 pieces when the (View more) button is pressed, how to implement this correctly?

let kitchenList = document.querySelector('.type-wardrobe');
let buttonMore = document.getElementById("btnMore");
let maxItems = 8;

function outputKitchens() {
    for (let i = 0; i < maxItems; i++) {
            let kitchenItem = document.createElement('li');
            kitchenItem.classList.add('type');
            kitchenList.append(kitchenItem);
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FeST1Val, 2021-07-02
@FeST1Val

I threw a variant on a quick hand. It's not perfect... it's not clear what you're doing)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question