cloneNode() - Cloning Existing Form Objects
- Introduction
for IE5.5+, N7+, and Mozilla 1.1
Several people have contacted me this year ( 2003 ) with questions about using cloneNode() with existing form objects. While each person had a different objective, all the questions started with the same scenario: cloning a table row that contains form elements, adding the new row to the table, and doing one or more of the following:
- giving the new elements unique names
- giving the new elements unique ids
- retaining the values or states of the original form elements
What we found is that there are many problems associated with cloning form elements. It's best used within a controlled intranet environment as long as you're aware of the support limitiations of the target browser. You can't expect any kind of consistent cross-browser support.
! SOLUTION ALERT !
Dave Chisholm has developed a great script that lets cloned form objects retain all the attributes and event handlers of the originals. You can see the form in action at http://www.receptiveearth.comPXL8 2003