Back to Exercises
Live Fields
emailInput.addEventListener('input', () => { /* validate */ });
passwordInput.addEventListener('input', () => { /* validate */ });
Full Code Used in This Demo
HTML
<input id="email" name="email" type="email" placeholder="you@example.com">
<input id="password" name="password" type="password">
CSS
.field input { border: 1px solid #cbd5e1; border-radius: 6px; }
JavaScript
const emailInput = document.getElementById('email');
const passInput = document.getElementById('password');