SUBMIT, refresh page and JS | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

SUBMIT, refresh page and JS

The problem is I have form with 4 inputs + input type=ā€œsubmitā€. I need after user click on button ā€œsendā€(submit), the form hidden and appear new block with smt like ā€œall ok, your data was send to usā€ (on this page, without relocating) I write small script. document.querySelector('input[type="submit"]').addEventListener('click', function(){ document.querySelector('#success').style.display = 'block'; document.querySelector('#form').style.display = 'none'; }) But because after you click on submit the page is refresh. And my click with ā€œok, info was sendā€ appear at 1 sec. and hide then... what should I do? The block #succes must stay at this page and not disappear at all. After user sending correct form.

23rd Oct 2018, 6:19 PM
Kate Hols
Kate Hols - avatar
1 Resposta
10th Nov 2018, 7:01 AM
Jason Kennedy