Created
January 14, 2010 14:03
-
-
Save diago/277179 to your computer and use it in GitHub Desktop.
This file contains 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
Element.addMethods('FORM', { | |
clone: function(form, id){ | |
// if no id was passed use native clone | |
if( ! Object.isString(id) ) return Element.clone(form, id); | |
var form = Element.clone(form, true); | |
form.writeAttribute('id', id); | |
// change elements with id attr | |
var origId, idElements = form.select('[id]'); | |
idElements.each(function(elem){ | |
origId = elem.identify(); | |
elem.writeAttribute('id', id+'_'+origId); | |
}); | |
return form; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment