How to make an animation when the button is pressed and then display the text?

The problem is, you need to make so that when pressing the button from the form, the animation load but a few seconds to deduce that I need the text on the screen, how it can be implemented, maybe there are examples of such script.
Thanks in advance
June 5th 19 at 21:51
2 answers
June 5th 19 at 21:53
Solution
Well, like so, did not make through variables to get shorter, but the point I think is clear:
document.getElementById('form').addEventListener('submit', function(e){
e.preventDefault();
 // Show block with a pre-made animatie download
 document.getElementById('loading').style.display = 'block';
 // After 2 seconds, run the function in which the concealed block with animation
 // and show the right text
 setTimeout(showText, 2000);
});
Here is an example of good, even very
because with JavaScript I'm not really, clarify some details
form variables and loading
I label them in the div?
tipo
<div id="form"><img src="load.gif"></div>
<div id="loading">my text</div>
- ernest_Waelchi commented on June 5th 19 at 21:56
Not quite. Wrap the image in div with id='loading', it will give display='block'. A diva with a text id such as 'result-message', it will show in the function showText. - carol.Heidenreich commented on June 5th 19 at 21:59
have I created a diva, prescribed in the styles to hidden hidden to not be seen immediately
as a sdet to be shown after the button is pressed - ernest_Waelchi commented on June 5th 19 at 22:02
, https://jsfiddle.net/56yea3my/ - carol.Heidenreich commented on June 5th 19 at 22:05
Thank you very much) - ernest_Waelchi commented on June 5th 19 at 22:08
June 5th 19 at 21:55
Here is an example, if submitting the form.
Jquery and Bootstrap js(to display pop-UPS, you can replace $('#elem').css('display' , 'block'); )

In the modal window #ok placed the upload icon(gif or through css, not important)

$(".contact-form-jq").submit(function(event) {
event.preventDefault();
 var data = $(this).serialize();
 url = 'mail.php';
$('#ok').modal('show');
 var posting = $.post(url,
data
);
 posting.done(function(data) {
 $("#ok-text").html('<b>submit this form</b>');

});
});
You apparently do not understand what I need
then just be clicking on the text pop-up window

But should be something like
Click on the button
The text from the form is uploaded to the database
after that you see the animation 2 seconds
as the animation ended the text will be displayed - ernest_Waelchi commented on June 5th 19 at 21:58

Find more questions by tags CSSHTMLJavaScript