feat: add email validation and toggle 'is-invalid' class for inputs with 'email-input' class
This commit is contained in:
@@ -35,6 +35,15 @@ $('.btn_reject').click(_ =>
|
||||
Swal.showValidationMessage(`Request failed: ${res.message}`);
|
||||
}));
|
||||
|
||||
document.querySelectorAll('.email-input').forEach(input => {
|
||||
input.addEventListener('input', function() {
|
||||
if (/^\S+@\S+\.\S+$/.test(this.value)) {
|
||||
this.classList.remove('is-invalid');
|
||||
} else {
|
||||
this.classList.add('is-invalid');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
class Comp {
|
||||
static ActPanel = class {
|
||||
|
||||
Reference in New Issue
Block a user