Magic Icon Clearing All Fields (via click): Magic JavaScript

Quick Jump ↵

Usage

Add data-mjf="clear_onclick" data-mjf_coc_form="FORM_ID" id="ELEMENT_ID" to your tag.

Add <script type="text/javascript">$m.wand.clear_onclick = true;</script> inside your <body> tag.

Example


Will also work on type="password" and type="file"


Radio Buttons



Checkboxes


This will set selectedIndex to -1

This will set selectedIndex to -1

Notes

It's best to use a <input type="button" value="Clear" data-mjf="clear_onclick" data-mjf_coc_form="form_clear_onclick">.

The <input type="reset" value="Reset"> will reset the fields to their default values and is only shown for clarification.

« Back to the main documentation