Created
June 1, 2012 15:35
-
-
Save mcwqy9/2853003 to your computer and use it in GitHub Desktop.
modified remove template function
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
function removeTemplate(template, decrement){ | |
if (!decrement){var decrement = false;} | |
var nextTemplates = template.nextAll('.template'); | |
nextTemplates.find('> legend > span').decrementLegendCount(); | |
nextTemplates.each(function(){ | |
$('label', $(this)).each(function(){ | |
$(this).attr('for', decrementFirstLevelAttributeIterator( $(this).attr('for') )); | |
}); | |
if (decrement == true ){ | |
$(':input', $(this)).each(function(){ | |
$(this).attr('id', decrementFirstLevelAttributeIterator( $(this).attr('id') )); | |
$(this).attr('name', decrementFirstLevelAttributeIterator( $(this).attr('name') )); | |
}); | |
} | |
}); | |
removeNestedFormElement(template); | |
hideRemovalLinkIfOnlyOne() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment