2023-11-02 21:33:55 +04:00
|
|
|
function validation() {
|
|
|
|
const forms = document.querySelectorAll("form.needs-validation");
|
|
|
|
|
|
|
|
for (let i = 0; i < forms.length; i += 1) {
|
|
|
|
const form = forms[i];
|
|
|
|
form.addEventListener("submit", (event) => {
|
|
|
|
if (!form.checkValidity()) {
|
|
|
|
event.preventDefault();
|
|
|
|
event.stopPropagation();
|
|
|
|
}
|
|
|
|
form.classList.add("was-validated");
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-03 11:28:48 +04:00
|
|
|
export default validation;
|