How to prevent form submission for some validations
Hi,
I’m developer, and I need to prevent form submission, then do some stuff, and if some conditons are well then submit the form. How I can prevent the form submission vis JS?
I’m trying to addEventListener and using e.preventDefault and e.stopPropagation but i can’t stop the submit. This is my code:
let form = document.querySelector(".klaviyo-form form");
form.addEventListener('submit', stop_submit);
function stop_submit(e){
e.preventDefault();
e.stopPropagation();
}How i can have the controll of submissions?
Thanks
