by Jason on August 24, 2008
Note: find the latest version of this plugin on Github!
So I just finished writing my first jQuery plugin! The idea behind it is simple – provide a dead simple way to apply a default value to any text-based form field.
In it’s current state, my plugin accomplishes the following:
- Provides a simple way to apply a default value to any text-based form field.
- Only shows default value for EMPTY form fields.
- Default value returns to an empty form field when it’s lost focus.
- Upon submitting the form, fields which still contain the default value are set to empty
$(“#myfield”).DefaultValue(“My Default Value..”);
I’m sure there are other plugins that satisfy these requirements and I’m not claiming that this is the best in the world, but it satisfies all my requirements and gave me the opportunity to develop my first jQuery Plugin!
I may enhance the plugin soon to incorporate styling to form fields.