vimuth vimuth - 1 year ago 107
HTML Question

button type reset not working for default values

Hi This is my form...

<form id="frmer" class="form-inline" method="POST">
<input name="inp1" value="sda"/>
<button type="submit" class="btn btn-primary mr5">Search</button>
<button type="reset" class="btn btn-default" form="frmer">Reset</button>

I want to clear this default value also from text input when I click the reset button. But unfortunately it wouldn't happen. If someone know how to archive it or any workaround it would be a great help..

Answer Source

Reset means "reset" not "blank". It is supposed to restore the default values.

If you want to blank the form, then you'll need JavaScript.

Loop over each control and test what type it is. Ignore buttons. Set the values of text, search, number, etc fields to "" (an empty string). Set the checked property of checkboxes to false and so on.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download