Skip to content

Instantly share code, notes, and snippets.

@nitishn
Created January 27, 2014 22:30
Show Gist options
  • Save nitishn/8658630 to your computer and use it in GitHub Desktop.
Save nitishn/8658630 to your computer and use it in GitHub Desktop.
// this script adds a "for" attribtue to wildfire form elements which have labels
// this allows for easier CSS styling.
//
var inputs = $(":input").not(":checkbox").not(":hidden").not(":submit").not(":button")
$.each( inputs, function( index, element ) {
var elementLabel = $(this).parents("ol").find('label').html();
if( elementLabel ) {
elementLabel = elementLabel.replace(/\s/g, '');
}
$(element).attr("for", elementLabel);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment