-
-
Save niccottrell/5bf1f2d34ab319ddd765 to your computer and use it in GitHub Desktop.
This file contains 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
// Inline Labels | |
// -------------------------------------------------- // | |
$('input, textarea').each(function() { | |
// load the corresponding label | |
var $self = $(this); | |
var $label = $("label[for='" + $self.attr("id") + "']"). | |
if ($label.text(); { | |
// if the label exists set the HTML5 placeholder attribute | |
$self.attr('placeholder', $label.text()); | |
// hide the old label now that we've moved the text | |
$label.hide(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment