Is there a way to clone form field values in jQuery or javascript?

后端 未结 7 630
礼貌的吻别
礼貌的吻别 2020-11-28 14:01

jQuery has a clone() function that clones the actual form with no problem, but it doesn\'t preserve any values that have been entered into the form.

Is

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-28 14:41

    Another easy fix for the textarea values not being cloned is to include the following JavaScript file in your HTML: https://github.com/spencertipping/jquery.fix.clone

    It just patches the clone method so you can include the file and then forget it's there. Apparently there is a problem with cloneing select values too and this same file fixes that problem as well.

    This file was linked to from: http://bugs.jquery.com/ticket/3016. The bug is 4 years old.

提交回复
热议问题