How to use jQuery to clear (and reinstate if necessary) default values in a Drupal 7 webform in 5 easy steps.

1. Create the file 'clear-defaults.js' and place it into the js directory of your theme (attached below, rename to clear-defaults.js).

2. Add the line then to your file, under ;scripts

 scripts[] = js/clear-defaults.js

3. For each webform item, add a default value in the form creation screen.

4. Clear your theme registry cache (or all caches).

5 Sorted!

Blog Category