...

View Full Version : hiding file and submit field after submit



docock
06-18-2010, 08:59 PM
I've got the following 2 fields in my form:

<input type="file" name="filename" id="filename" value="filename">
<input type="submit" name="submit" value="Upload Image" />

Now I want to hide both of them as soon as the submit button is pressed. Problem is that I'm a javascript noob and I can't find it with google :S

Can someone help me?

Old Pedant
06-18-2010, 09:37 PM
<div id="hider">
<input type="file" name="filename" id="filename" value="filename">
<input type="submit" name="submit" value="Upload Image"
onclick="document.getElementById('hider').style.display='none';return true;" />
</div>

Or, if it's not convenient to have the two fields in the same <div>,


<input type="file" name="filename" id="filename" value="filename">
<input type="submit" name="submit" value="Upload Image"
onclick="this.form.filename.style.display = this.style.display = 'none'; return true;" />

p.s.: No real reason to have an id for that <input> field, you know.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum