Home / code

Change Submit button on click

Writer: Christophe Wolfs
Published: 27 March 2008

This is a small script that change the submit button once it is pressed. So user can "see" that the form is sending something.

Put this in the HEAD-section:

<script language="JavaScript">
//Code provided by http://www.webmaster2020.com
function SubmitForm(btn)
  btn.value=" Sending... ";
  return true;

The form and the form button:

<form name='theform' onSubmit="return SubmitForm(this.submitbutton)">
Anything:  <input type=text name='anything' size=20> <input type='submit' name='submitbutton' value="Send">