Last active
December 19, 2015 12:28
-
-
Save trentsnippets/5954617 to your computer and use it in GitHub Desktop.
This jQuery code will make form values show / hide on click so you can use them as titles.
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
$(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'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment