How to clear the default value in a Drupal webform on focusHow to clear the default value in a Drupal webform on focus

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 theme.info 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!

AttachmentSize
clear-defaults.js.txt1.67 KB

Comments

Post new comment