27 lines
735 B
JavaScript
27 lines
735 B
JavaScript
document.addEventListener('click', (e) => {
|
|
const t = e.target;
|
|
|
|
// password toggle
|
|
if (t && t.matches('[data-toggle="password"]')) {
|
|
const pw = document.getElementById('password');
|
|
if (!pw) return;
|
|
|
|
const isPw = pw.type === 'password';
|
|
pw.type = isPw ? 'text' : 'password';
|
|
t.textContent = isPw ? '숨기기' : '보기';
|
|
return;
|
|
}
|
|
});
|
|
|
|
document.addEventListener('submit', (e) => {
|
|
const form = e.target;
|
|
if (!form || !form.matches('[data-form="login"]')) return;
|
|
|
|
const btn = form.querySelector('[data-submit]');
|
|
if (btn) {
|
|
btn.disabled = true;
|
|
btn.dataset.original = btn.textContent;
|
|
btn.textContent = '처리 중...';
|
|
}
|
|
});
|