</> ConvertAtlas Developer Tools
Bootstrap 5 · Advanced

Inline Form Validation

A form with live field validation that enables submit when valid.

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:360px"><div class="card-body">
  <div class="mb-3"><label class="form-label small fw-semibold">Username</label><input class="form-control" id="ivUser" placeholder="min 3 chars"><div class="form-text" id="ivUserMsg"></div></div>
  <div class="mb-3"><label class="form-label small fw-semibold">Email</label><input class="form-control" id="ivEmail" placeholder="you@example.com"><div class="form-text" id="ivEmailMsg"></div></div>
  <button class="btn btn-primary w-100" id="ivSubmit" disabled>Submit</button>
</div></div>
var u=document.getElementById('ivUser'),e=document.getElementById('ivEmail'),btn=document.getElementById('ivSubmit');
function check(){var uok=u.value.length>=3,eok=/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e.value);
u.classList.toggle('is-valid',uok);u.classList.toggle('is-invalid',u.value&&!uok);document.getElementById('ivUserMsg').textContent=uok?'✓ Available':(u.value?'Too short':'');
e.classList.toggle('is-valid',eok);e.classList.toggle('is-invalid',e.value&&!eok);document.getElementById('ivEmailMsg').textContent=eok?'✓ Looks good':(e.value?'Invalid email':'');
btn.disabled=!(uok&&eok)}
u.addEventListener('input',check);e.addEventListener('input',check);
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.