I want to create a delay between these two messages:
$(\'#submit-account\').html(animation + \'Submitting Data\')
$(\'#submit-account\').html(animation + \'Valid
I'm not sure if i'm understanding it precisely or correct but there's a Default Built in JavaScript setTimeOut(); Function.
For more info :How to wait 5 seconds with jQuery?
I think that problem is because delay()
only delays item(s) in a queue (jQuery queues automatically only animations).
So try to modify fade function to fadeIn(0)
and jQuery will interpret it as animation and now delay should works.
maybe you need to link JQuery 1.9.1, this is working: jsFiddle is here
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
and note that delay()
method is for delaying between queued jQuery effects.
take a look at this jsFiddle
reference
make sure the #submit-account is hidden already.
instead of your code you can try this
$('#submit-account').html(ani + "Wait").fadeIn(5000);
$('#submit-account').html(ani + "Done").fadeIn(5000);
This will control the speed of the fadein effect.
or if you want the div to be fadein after some time, you can use the setTimeOut()
function.
Hope this will help you