I am using a workaround to clone form input elements with jQuery and for it to work in Internet Explorer. The following code clones the elements successfully but it also clones the input states and values. What would the best way be to clear the states and values? The problem is that there is a mixture of radio, checkbox and textfields, so I can’t just clear input values, checked and selected states have to be considered.
Thanks for any pointers!
function setElementName(elems, name) {
if ($.browser.msie === true){
$(elems).each(function() {
this.mergeAttributes(document.createElement("<input name='" + name + "'/>"), false);
});
} else {
$(elems).attr('name', name);
}
}
Finally found a workaround for this, as follows: