Skip to content

Instantly share code, notes, and snippets.

@pragmatic-web
Created August 1, 2012 10:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pragmatic-web/3225610 to your computer and use it in GitHub Desktop.
Save pragmatic-web/3225610 to your computer and use it in GitHub Desktop.
jQuery Watermark.js Gravity Forms using the field labels
jQuery(document).ready(function() {
// Watermarks
// Watermark on contact form
jQuery('.gfield:not(.watermark-name)').each(function() {
$currLabel = jQuery(this).find('label').text();
jQuery(this).find('input,textarea').watermark($currLabel, {className: 'childtheme-watermark'} );
});
// For complex name
jQuery('.ginput_complex span').each(function() {
$currLabel = jQuery(this).find('label').text();
$currLabel = $currLabel + '*';
jQuery(this).find('input').watermark($currLabel, {className: 'childtheme-watermark'} );
});
});
@pragmatic-web
Copy link
Author

Assumes you've got jQuery, jQuery Watermark (http://code.google.com/p/jquery-watermark/) installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment