Adding data-bs-slide-to

Hi everyone, was wondering on how I can add a data-bs-slide-to-(number increases by one everytime I click on a button) into a li tag. Here's the HTML code <ol class="carousel-indicators"> <li data-target="#carouselExampleIndicators" data-bs-slide-to="0" class="active"></li> <li data-target="#carouselExampleIndicators" data-bs-slide-to="1"></li> <li data-target="#carouselExampleIndicators" data-bs-slide-to="2"></li> <li data-target="#carouselExampleIndicators" data-bs-slide-to="3"></li> </ol> Here's the JS code I have so far const createLi = document.createElement('li') createLi.innerHTML = <li data-target="#carouselExampleIndicators" data-bs-slide-to="3"></li>; const getCarouselIndicators = document.querySelector('.carousel-indicators'); getCarouselIndicators.append(createLi)
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server