Effects: How to execute effects on thwo elements each after the other

Effects: How to execute effects on thwo elements each after the other

Hi,

I'm a noob to jQuery and trying to get some UI effects in place. Here is what I try to do:

When a form with an <input type="file"> gets submitted the file upload element should get hidden while a div containing some "please wait..." stuff should be shown. I try to do it the way hiding the upload elements gets entirely hidden before start showing the wait-message-element. I read a little about queuing, callbacks etc. but didn't get it ready "nice" meaning that the second animation is not completely shown.

I am not sure if I missed something in my code or if this maybe is a limitation with the html form submitting behavior.

My HTML looks like this:
  1. <form id="picUploadForm" method="post" ...>
  2. <input type="file" id="file" name="file" />
  3. <input type="submit" id="picSubmitBtn" value="Next" />
  4. <div id="uploadIndicator" style="display: none;">Please wait ...</div>
  5. </form>
My script like this:
  1. <script language="javascript" type="text/javascript">
  2. $(document).ready(function() {
  3. $("#picUploadForm").submit(function() {
  4. $("#file").hide('fold', null, 500, function callback(){
  5. $("#uploadIndicator").show('clip', null, 500);
  6. });
  7. });
  8. });
  9. </script>

Basically I like to hide the #file element before starting showing the #uploadIndicator.

Anybody have an idea how to improve this?

Thanks and cheers,
Marc