</> ConvertAtlas Developer Tools
Bootstrap 5 · Advanced

Validated Step Wizard

A nav-pills wizard that validates the email step before advancing.

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:380px"><div class="card-body">
  <ul class="nav nav-pills nav-justified mb-3" id="swPills"><li class="nav-item"><span class="nav-link active py-1 small">1</span></li><li class="nav-item"><span class="nav-link py-1 small">2</span></li><li class="nav-item"><span class="nav-link py-1 small">3</span></li></ul>
  <div data-sw="0"><input class="form-control mb-2" id="swEmail" placeholder="Email"><div class="text-danger small" id="swErr" style="display:none">Enter a valid email.</div></div>
  <div data-sw="1" style="display:none"><input class="form-control" placeholder="Full name"></div>
  <div data-sw="2" style="display:none"><p class="text-success small">All steps complete!</p></div>
  <div class="d-flex justify-content-between mt-3"><button class="btn btn-light btn-sm" id="swBack">Back</button><button class="btn btn-primary btn-sm" id="swNext">Next</button></div>
</div></div>
var steps=document.querySelectorAll('[data-sw]'),pills=document.querySelectorAll('#swPills .nav-link'),i=0;
function show(){steps.forEach(function(s,k){s.style.display=k===i?'block':'none'});pills.forEach(function(p,k){p.classList.toggle('active',k===i)});document.getElementById('swNext').textContent=i===steps.length-1?'Finish':'Next'}
document.getElementById('swNext').onclick=function(){if(i===0){var e=document.getElementById('swEmail'),ok=/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e.value);document.getElementById('swErr').style.display=ok?'none':'block';if(!ok)return}if(i<steps.length-1){i++;show()}};
document.getElementById('swBack').onclick=function(){if(i>0){i--;show()}};
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.