Created
September 30, 2015 18:38
-
-
Save justinallen/651f4f905bc1e0814bd2 to your computer and use it in GitHub Desktop.
fancies up a form
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
// takes a parent el (like a li) and goes to work on its children | |
// assumes the parent has one label and one input | |
function labelsToPlaceholders(parent) { | |
$(parent).each( function(index){ | |
$(this).children('label').css('display', 'none'); | |
labelText = $(this).children('label').text(); | |
labelText = labelText.slice(0,-1); | |
// console.log(labelText); | |
$(this).children('input').attr('placeholder', labelText); | |
} ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment