Skip to content

Instantly share code, notes, and snippets.

@justinallen
Created September 30, 2015 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinallen/651f4f905bc1e0814bd2 to your computer and use it in GitHub Desktop.
Save justinallen/651f4f905bc1e0814bd2 to your computer and use it in GitHub Desktop.
fancies up a form
// 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