Jump to content

Recommended Posts

You can do it by calling a javascript function using the onsubmit event in the form tag. The function then adds a class to the button which hides it (display:none;). Very much like this:

 

HTML

<form action="#" method ="POST" onsubmit="return hideButton()">

<!-- other form stuff-->

<input type="submit" name="sumit" id="submit" value="submit"/>
</form>

 

Javascript

function hideButton(){
document.getElementById("submit").className="hide";

return false;
}

 

CSS

.hide{
display:none;
}

 

I've got the return false in the javascript function because I didn't want my browser to be trying to submit a page when I was testing. This will need to return true, otherwise the form will never submit :).

 

Hope that helps.

 

Denno

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.