Created
September 30, 2010 18:18
-
-
Save rc1/605046 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // add js-clear class to input to enable | |
| function defaultInputs(className) { | |
| $('input.' + className).each( function () { | |
| $(this).bind('focus', function () { | |
| $this = $(this); | |
| if($this.val() == this.defaultValue) { | |
| $this.val(''); | |
| } | |
| }); | |
| $(this).bind('blur', function () { | |
| $this = $(this); | |
| if($this.val().length == 0) { | |
| $this.val(this.defaultValue); | |
| } | |
| }) | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment