Created
September 26, 2011 18:22
-
-
Save andershaig/1242944 to your computer and use it in GitHub Desktop.
Store Values on Page Load, Replace When Empty
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
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$('form input:text, form textarea').each(function(){ | |
$.data(this, 'default', this.value); | |
}).focus(function(){ | |
if ($.data(this, 'default') == this.value) { | |
this.value = ''; | |
} | |
}).blur(function(){ | |
if (this.value == '') { | |
this.value = $.data(this, 'default'); | |
} | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment