Loading Spinner Button
A submit button that shows a spinner and disables while loading.
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><button class="btn btn-primary" id="sbBtn">Save changes</button>document.getElementById("sbBtn").onclick=function(){var b=this;if(b.dataset.busy)return;b.dataset.busy=1;var o=b.innerHTML;b.innerHTML='<span class="spinner-border spinner-border-sm me-1"></span>Saving…';b.disabled=true;setTimeout(function(){b.innerHTML='✓ Saved';setTimeout(function(){b.innerHTML=o;b.disabled=false;b.dataset.busy=""},1000)},1500)};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.