I have an HTML element with a large collection of unordered lists contained within it. I need to clone this element to place elsewhere on the page with different styles adde
FWIW, I used Dario's function, but needed to catch form labels as well.
Add another if statement like this to do so:
if(element.htmlFor){ var matches = element.htmlFor.match(/(.+)_\d+/); if(matches && matches.length >= 2) // Captures start at [1]. element.htmlFor = matches[1] + "_" + cur_num; }