Load More List
A list that appends more items on click until the limit.
Requires Bootstrap 5. Add the CDN tags below to your page (styles in
<head>, scripts before </body>). The downloaded file already includes them.<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"><script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script><div class="card border-0 shadow-sm" style="max-width:320px"><div class="card-body">
<ul class="list-group mb-2" id="lmList"><li class="list-group-item py-2 small">Item 1</li><li class="list-group-item py-2 small">Item 2</li><li class="list-group-item py-2 small">Item 3</li></ul>
<button class="btn btn-outline-primary btn-sm w-100" id="lmBtn">Load more</button>
</div></div>var list=document.getElementById('lmList'),btn=document.getElementById('lmBtn'),n=3;
btn.onclick=function(){for(var k=0;k<3;k++){n++;var li=document.createElement('li');li.className='list-group-item py-2 small';li.textContent='Item '+n;list.appendChild(li)}if(n>=12){btn.disabled=true;btn.textContent='No more items'}};Free to use.This component uses Bootstrap 5 (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.