Last active
August 29, 2015 14:19
-
-
Save ksnider/720dfaa316ace3b5933c to your computer and use it in GitHub Desktop.
Put labels in fields (updated)
This file contains hidden or 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
<script type="text/javascript"> | |
$ = jQuery; | |
$(document).ready(function() { | |
$.each($('input[type=text]'), function(k, v) { | |
var input = $('#' + v.id); | |
var label = $('label[for="' + v.id + '"]').first(); | |
var text = label.html().replace(/ \*/, '') || ''; | |
label.closest('td').remove(); | |
input.attr('placeholder', text).css('width', '100%'); | |
input.closest('td').css('width', '100%'); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment