This might be a broad answer to give but i\'l try to shorten it up. What i am trying to do is use a form to get some information from the user and \"validate the form\" using Ja
You need to use event.preventDefault()
to prevent the default action of the form, which is submitting.
Change
document.getElementById('submit').addEventListener('click',
function(e){
document.querySelector('.feedback-background').style.display='none';
document.querySelector('.popup').style.display='flex';
}
To
document.getElementById('submit').addEventListener('click',
function(e){
document.querySelector('.feedback-background').style.display='none';
document.querySelector('.popup').style.display='flex';
e.preventDefault();
}
However, preventing the form from submitting will prevent the data from the form from being sent to the server to be processed and saved in the database. To be able to process data sent to the server, you will need to use some server-side programming language and you will need to set the form's action
attribute; Javascript is not sufficient for this task.