Skip to content

Instantly share code, notes, and snippets.

@EdwardIII
Created March 6, 2013 17:20
Show Gist options
  • Save EdwardIII/5101101 to your computer and use it in GitHub Desktop.
Save EdwardIII/5101101 to your computer and use it in GitHub Desktop.
;(function ( $, window, document, undefined ) {
$.fn.labelForPlaceholder = function(){
return $(this).each(function(){
if(!$(this).hasClass('has-label-for-placeholder')){
$(this).keypress(function(){
if(!$(this).parents('.control-group').hasClass('has-had-keypress')){
$(this).parents('.control-group').addClass('has-had-keypress');
}
});
$(this).addClass('has-label-for-placeholder');
}
});
}
})(jQuery, window, document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment