Jquery步骤";销毁";方法是删除用户给定的值

Jquery steps "destroy" method is removing values given by User

本文关键字:quot 用户 方法 步骤 销毁 Jquery 删除      更新时间:2023-09-26

我有一个调查表,它使用JQuery步骤插件按步骤分解。在提交表格的过程中,有一点我需要删除步骤。当我使用"destroy"JQuery steps方法时,表单中填写的值将丢失。

例如:

<form>
<h3>Form A</h3>
<section>
    What is your name?<br/>
    <input type="text" value="" name="yourname" />
    What is your age group? <br/>
    <input type="radio" name="agegroup" value="1" />1-20
    <input type="radio" name="agegroup" value="2" />20-40
    <input type="radio" name="agegroup" value="3" />40-60
    <input type="radio" name="agegroup" value="4" />60+
   ......
   ......
<section>
</form>

我使用以下步骤:

  1. 将表单转换为Jquery步骤
  2. 在"简单模式"对话框中打开此窗体
  3. 用户填写此表单并关闭模式对话框
  4. 我在关闭对话框后使用"destroy"jQuery步骤方法
  5. 当用户再次重新打开简单模式对话框时,我将把这个表单转换为JQuery步骤。这时,用户会看到表单中所有填充的值都将丢失

问题出现在第4步。用户已在第三步填写表格。当我转换回原始HTML时,用户给出的值将丢失

第4步的预期值

<h3>Form A</h3>
<section>
    What is your name?<br/>
    <input type="text" value="Ishwar Lal" name="yourname" />
    What is your age group? <br/>
    <input type="radio" name="agegroup" value="1" />1-20
    <input type="radio" name="agegroup" value="2" selected='selected' />20-40
    <input type="radio" name="agegroup" value="3" />40-60
    <input type="radio" name="agegroup" value="4" />60+
   ......
   ......
<section>

但输出为:

<h3>Form A</h3>
<section>
    What is your name?<br/>
    <input type="text" value="" name="yourname" />
    What is your age group? <br/>
    <input type="radio" name="agegroup" value="1" />1-20
    <input type="radio" name="agegroup" value="2" />20-40
    <input type="radio" name="agegroup" value="3" />40-60
    <input type="radio" name="agegroup" value="4" />60+
   ......
   ......
<section>

我需要从中删除带有填充值的JQuery步骤我已经阅读了JQuery文档,但对此没有任何想法。

我认为在销毁组件之前必须存储数据。当你销毁一个组件时,它就被销毁了,别无选择。如果存储数据,则销毁对象,然后使用存储的数据初始化对象。您可以存储在阵列/对象/变量中,也可以存储在sessionStorage/localStorage中以用于其他页面。