I wrote a form validation using JavaScript, but I don't know how to link this validation with sweetalert2, so it only submits when the validation is true.
//Event listener for the form
form.addEventListener('submit', function (e) {
e.preventDefault();
checkInputs();
checkLength(password, 3, 15);
checkLength(username, 3, 15);
Swal.fire('Form Submission Successful', 'Thank you', 'success');
});
I only want it to submit when the form passes the validation.