Skip to main content

Bug Tracker

Side navigation

#2941 closed bug (wontfix)

Opened May 27, 2008 02:36AM UTC

Closed March 17, 2009 10:54PM UTC

Last modified March 14, 2012 05:34PM UTC

<select> value and selected option not preserved on clone

Reported by: fligtar Owned by: flesler
Priority: major Milestone: 1.3
Component: core Version: 1.2.5
Keywords: clone select option Cc:
Blocked by: Blocking:

See test case here:

When cloning a table row with a select box and a checkbox, the checkbox's value will be preserved, but the select box's value will not.

I was able to reproduce this in Firefox 3 and Safari.

Attachments (0)
Change History (5)

Changed May 27, 2008 01:27PM UTC by flesler comment:1

need: ReviewPatch
owner: → flesler
status: newassigned

I think this is expected, the browser respects the selected and checked attributes. (Both are resetted on IE).

Maybe copying the value (or selectedIndex) attribute will be enough. Will check this when I get some time.

Thanks for the straight test case, much appreciated.

Changed January 18, 2009 12:14AM UTC by dmethvin comment:2

keywords: testcasetestcase clone

Changed February 19, 2009 11:49PM UTC by dmethvin comment:3

keywords: testcase cloneclone select option

See also #4193.

Changed March 17, 2009 10:54PM UTC by brandon comment:4

resolution: → wontfix
status: assignedclosed

This was at one time in core but was removed due to the large performance overhead for such an edge case. I'm not convinced that the values should be cloned with the form elements. To really make it work cross browser you'd have to change the name attributes and ids as well. I remember having issues with radio buttons in Opera where even though it was in a different form only one could be checked. Either the original or the clone.

See also #3716

Changed March 31, 2010 05:34PM UTC by GayQuery comment:5

First, welcome to Spamalot!

Someone delete the pseudo-medicine trash from harmony and maddie please.

Secondly, if you're a genius like me, and performance isn't an issue in a specific case then you can do something like this [excerpt]:

var erg=jQuery("td.add_row",row.parent().parent());

var elf=jQuery("<tr/>");






var flippingheck=jQuery(item).clone().appendTo(elf);

var bloodyhell=jQuery("select",jQuery(item));

var buggerme=jQuery("select",flippingheck);











// Other stuff after here