SUBMIT, refresh page and JS | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
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 Réponse
10th Nov 2018, 7:01 AM
Jason Kennedy