You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 25, 2020. It is now read-only.
Textarea and select clone() bug workaround | Spencer Tipping
Licensed under the terms of the MIT source code license
Motivation.
jQuery's clone() method works in most cases, but it fails to copy the value of textareas and select elements. This patch replaces jQuery's clone() method with a wrapper that fills in the
values after the fact.
An interesting error case submitted by Piotr Przybył: If two <select> options had the same value, the clone() method would select the wrong one in the cloned box. The fix, suggested by Piotr
and implemented here, is to use the selectedIndex property on the <select> box itself rather than relying on jQuery's value-based val().