views:

128

answers:

1

I want the submit button to disappear after it's clicked and a new layer to show in its place.

Here is what I have so far:

<div id=uploadform>
<form enctype="multipart/form-data" action='' method='POST'> 
<input type="file" name="imagefile" class=browse>
<p><input type='submit' value='Upload' class=uploadsubmit onClick="if($(this).('#loading').css('display') == 'none') { $(this).('#loading').show('fast'); $(this).hide('fast'); }  return false;">
<input type='hidden' value='1' name='submitted' /> 
</form> 
</div>
<div id=loading style="display:none;"><img src=upload.gif></div>

Nothing happens when I click submit, no show/hide, no form action.

What should I do? (using latest version of jQuery)

+1  A: 

Try this instead:

<input type='submit' value='Upload' class=uploadsubmit
    onClick="$('#loading').show('fast'); $(this).hide('fast');">

Your $(this).('#loading') won't do anything, and the return false; will stop the form from submitting.

Greg
much thanks! I figured out the ($this) part (duh, lol) but the return part was news to me. Thanks again for your time.
Patrick