Basically I've got a form on which a user can either fill out everything or they can select from some stored forms that they have previously saved. If they select a stored form I iterate through the input fields in the existing form and remove them using parentelement.removeChild(this) and then add the new fields in. This works fine when the user's saved form only contains a handful of items (< 10) but when it contains 10+ items the browser freezes for 10 seconds as it adds the fields to the form. I tried adding a little loading gif while the form is being loaded but that freezes too.
My general and sadly not specific question is: Is there a way to do this more efficiently? E.g., clone the existing form, operate on the clone and then replace the existing form with the now modified clone? (I'm not even sure that would provide any benefit and I'd try it out to test it but I'm not quite certain how that would work).
Any insight is greatly appreciated.