I want to stop my e.Preventdefault() after a successful validation of form. I want to send all the data of form in mysql.... But just because of e.Preventdefault() i can't send the data to mysql. Form is stuck in the same page.
form.addEventListener('submit',(e)=>{
e.preventDefault();
checkInputs();
successMsg();
});
i assume checkInputs() function is returning boolean only for validation so you can place you code in boolean in this manner below
form.addEventListener('submit',(e)=>{
if(checkInputs() == false){e.preventDefault();}
else{successMsg();}
});