View on GitHub

jQuery Autoclear

A tiny plugin to clear input text fields on focus

Download this project as a .zip file Download this project as a tar.gz file

A simple plugin to clear input text fields on focus, and manage default values.

Setup

Example:

Styling

The plugin adds two classes to your elements wether they are focused or modified by user :

On focus, a .focus_input class will be added to the field. When the user leaves the field, the .focus_input is removed and the script checks if the value has changed from the default value. If it has changed, a .modified_input class is added. Else, no extra class is added (default style).