tags:

views:

98

answers:

4

I'm trying to have a clear button inside a html form, but it appears to automatically submit. How do I work around this?

I feel like I am missing something obvious.

Thank you, I have a working answer ... so now I'm just curious. Is there any reason to use the button element in a form, or any reason not to?

+5  A: 

You have to make the type of the input element "reset", not "submit".

edit: fixed .. reset, not clear

eduffy
You mean "Reset", not clear
Ken Pespisa
+1  A: 

Try this:

<input type="reset" name="reset" value="Clear"/>
Ken Pespisa
+1  A: 
<input type="reset" name="reset" value="Reset Form">
second
A: 

try this, instead of submit button :

<input type="reset" value="Clear Form">
Canavar