Password Visibility Toggle
A password input with a button that toggles visibility.
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:340px"><div class="card-body">
<label class="form-label small fw-semibold">Password</label>
<div class="input-group"><input type="password" class="form-control" id="ptInput" value="secret123"><button class="btn btn-outline-secondary" id="ptBtn">👁</button></div>
</div></div>var i=document.getElementById('ptInput'),b=document.getElementById('ptBtn');
b.onclick=function(){var p=i.type==='password';i.type=p?'text':'password';b.textContent=p?'🙈':'👁'};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.