jQuery步骤-重置向导而无需重新加载页面 [英] jQuery Steps - reset wizard without page reload

查看:79
本文介绍了jQuery步骤-重置向导而无需重新加载页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery步骤( https://github.com/rstaib/jquery-steps/wiki ),以逐步创建表格向用户填写.它很好用,但是我需要能够重置它.用户提交表单后(使用ajax,因此页面不会刷新),我想向用户展示一个新向导.

I am using jQuery steps ( https://github.com/rstaib/jquery-steps/wiki ) in order to create step by step form to users to fill out. It works great, however I need to be able to reset it. Once user submitted the form (using ajax so the page doesn't refresh), I would like present a user fresh wizard.

是否可以重置向导?还是要在不重新加载页面的情况下重新加载?

Is there a way to reset the wizard? Or perhaps to reload without reloading the page?

推荐答案

我能够通过向解决方案中添加几行代码来重置我的jQuery步骤向导

I was able to reset my jQuery steps wizard by adding a few lines of code to the solution here, plus a couple extra lines of code to remove the css classes. You'll still need to reset your form using your preferred library before or after calling this function.

$.fn.steps.reset = function () {
  var wizard = this,
  options = getOptions(this),
  state = getState(this);
  goToStep(wizard, options, state, 0);

  for (i = 1; i < state.stepCount; i++) {
    var stepAnchor = getStepAnchor(wizard, i);
    stepAnchor.parent().removeClass("done")._enableAria(false);
  }
};

这篇关于jQuery步骤-重置向导而无需重新加载页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆