Ticket #5524 (closed bug: duplicate)
clone() doesn't clone the textarea's text value
| Reported by: | bluedevil2k | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.4 |
| Component: | core | Version: | 1.3.2 |
| Keywords: | clone textarea | Cc: | |
| Blocking: | Blocked by: |
Description
When calling clone() on an entire DIV that contains multiple textarea elements, the cloned textarea's returns blank on a call to .val(), while the original still returns the correct text on .val().
Here's some sample code to reproduce the problem (assume there are multiple DIV's on the page, each with multiple textareas with text in them).
jQuery("div").each(function(){
var clone = jQuery(this).clone(); console.log(jQuery(this).find("textarea").eq(0).val()); will output correct text
console.log(clone.find("textarea").eq(0).val()); will output blank
});
This was seen in Firefox 3.5 and IE8.
Change History
comment:2 Changed 3 years ago by szrudi
will this be fixed? as I see it's a bug for more than 2 years now.. (same as #3016)
comment:3 Changed 3 years ago by addyosmani
- Status changed from new to closed
- Resolution set to duplicate
Closing as a duplicate of #3016.
comment:5 follow-up: ↓ 6 Changed 2 months ago by anonymous
3 years and no patch? anyone interested in resolving this? I have no idea how to propose patched code to the jQuery team
comment:6 in reply to: ↑ 5 Changed 2 months ago by scott.gonzalez
Replying to anonymous:
3 years and no patch? anyone interested in resolving this?
You should read the discussions in the duplicates. Specifically, read http://bugs.jquery.com/ticket/3016#comment:17
I have no idea how to propose patched code to the jQuery team
Send a pull request on GitHub: http://contribute.jquery.org/code/
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Closed dup #5641 with further discussion.