-1

I wish to add an element to the form body which is a clone of the select element (id='name') whenever we change another select element's value (id='class')from the dropdown. The problem is that it creates the clone without regards to whether we have changed the (id='name')'s value to something other than the original. Suppose I have changed the name to "Harry" (and the default was "Please select"), the clone is created with "Please select" and not with "Harry".

I wish the cloning to retain the dynamically changed attributes too (all of them).

Here is the fiddle for the same.

Daud
  • 7,429
  • 18
  • 68
  • 115
  • 1
    This may be of interest http://stackoverflow.com/questions/742810 – Doug Owings Nov 12 '11 at 06:56
  • Thanks. The bug mentioned there says that the problem occurs only in IE, but its there is Firefox as well as Chrome. Anyway, is it that the clone method only fails in the case of a select or in any other too ? – Daud Nov 12 '11 at 08:54

1 Answers1

1

.copy doesnt clone selected value. you can copy them by yourself: http://jsfiddle.net/kcuKT/4/

korywka
  • 7,537
  • 2
  • 26
  • 48
  • Thanks. Is it that the clone element fails only in the case of 'select', or do I have to copy other attributes of (even nested element's) manually – Daud Nov 12 '11 at 08:56