Skip to content

Instantly share code, notes, and snippets.

@mcwqy9
Created June 1, 2012 15:35
Show Gist options
  • Save mcwqy9/2853003 to your computer and use it in GitHub Desktop.
Save mcwqy9/2853003 to your computer and use it in GitHub Desktop.
modified remove template function
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