Jquery步骤未正确显示

Jquery步骤未正确显示,jquery,html,forms,tags,jquery-steps,Jquery,Html,Forms,Tags,Jquery Steps,我在创建一个Jquery步骤表单模板时遇到了问题,该模板显示在我所关注的网站上,但仍然有一个模板显示不正确,请向我提供一些帮助 代码如下所示: <!DOCTYPE html> <html> <head> <title>Demo</title> <meta charset="utf-8"> <script src="https://ajax.googleapis.c

我在创建一个Jquery步骤表单模板时遇到了问题,该模板显示在我所关注的网站上,但仍然有一个模板显示不正确,请向我提供一些帮助

代码如下所示:

<!DOCTYPE html>
<html>
    <head>
        <title>Demo</title>
        <meta charset="utf-8">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
        <link rel="stylesheet" type="text/css" href="css/jquery.steps.css">
        <script src="js/jquery.steps.js"></script>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    </head>
    <body>
        <script>
            $("#wizard").steps();           

            var form = $("#example-advanced-form").show();

            form.steps({
                headerTag: "h3",
                bodyTag: "fieldset",
                transitionEffect: "slideLeft",
                onStepChanging: function (event, currentIndex, newIndex)
                {
                    // Allways allow previous action even if the current form is not valid!
                    if (currentIndex > newIndex)
                    {
                        return true;
                    }
                    // Forbid next action on "Warning" step if the user is to young
                    if (newIndex === 3 && Number($("#age-2").val()) < 18)
                    {
                        return false;
                    }
                    // Needed in some cases if the user went back (clean up)
                    if (currentIndex < newIndex)
                    {
                        // To remove error styles
                        form.find(".body:eq(" + newIndex + ") label.error").remove();
                        form.find(".body:eq(" + newIndex + ") .error").removeClass("error");
                    }
                    form.validate().settings.ignore = ":disabled,:hidden";
                    return form.valid();
                },
                onStepChanged: function (event, currentIndex, priorIndex)
                {
                    // Used to skip the "Warning" step if the user is old enough.
                    if (currentIndex === 2 && Number($("#age-2").val()) >= 18)
                    {
                        form.steps("next");
                    }
                    // Used to skip the "Warning" step if the user is old enough and wants to the previous step.
                    if (currentIndex === 2 && priorIndex === 3)
                    {
                        form.steps("previous");
                    }
                },
                onFinishing: function (event, currentIndex)
                {
                    form.validate().settings.ignore = ":disabled";
                    return form.valid();
                },
                onFinished: function (event, currentIndex)
                {
                    alert("Submitted!");
                }
            }).validate({
                errorPlacement: function errorPlacement(error, element) { element.before(error); },
                rules: {
                    confirm: {
                        equalTo: "#password-2"
                    }
                }
            });


        </script>
        <div id="wizard">
            <form id="example-advanced-form" action="#">
                <h3>Account</h3>
                <fieldset>
                    <legend>Account Information</legend>
                    <label for="userName-2">User name *</label>
                    <input id="userName-2" name="userName" type="text" class="required">
                    <label for="password-2">Password *</label>
                    <input id="password-2" name="password" type="text" class="required">
                    <label for="confirm-2">Confirm Password *</label>
                    <input id="confirm-2" name="confirm" type="text" class="required">
                    <p>(*) Mandatory</p>
                </fieldset> 
                <h3>Profile</h3>
                <fieldset>
                    <legend>Profile Information</legend>     
                    <label for="name-2">First name *</label>
                    <input id="name-2" name="name" type="text" class="required">
                    <label for="surname-2">Last name *</label>
                    <input id="surname-2" name="surname" type="text" class="required">
                    <label for="email-2">Email *</label>
                    <input id="email-2" name="email" type="text" class="required email">
                    <label for="address-2">Address</label>
                    <input id="address-2" name="address" type="text">
                    <label for="age-2">Age (The warning step will show up if age is less than 18) *</label>
                    <input id="age-2" name="age" type="text" class="required number">
                    <p>(*) Mandatory</p>
                </fieldset>         
                <h3>Warning</h3>
                <fieldset>
                    <legend>You are to young</legend>
                    <p>Please go away ;-)</p>
                </fieldset> 
                <h3>Finish</h3>
                <fieldset>
                    <legend>Terms and Conditions</legend>         
                    <input id="acceptTerms-2" name="acceptTerms" type="checkbox" class="required"> <label for="acceptTerms-2">I agree with the Terms and Conditions.</label>
                </fieldset>
            </form>
        </div>
    </body>
</html>  

演示
$(“#向导”).steps();
var form=$(“#示例高级表单”).show();
形式.步骤({
头像:“h3”,
bodyTag:“字段集”,
过渡效果:“slideLeft”,
onStepChanging:函数(事件、currentIndex、newIndex)
{
//即使当前表单无效,也始终允许以前的操作!
如果(currentIndex>newIndex)
{
返回true;
}
//如果用户太年轻,则禁止在“警告”步骤上执行下一步操作
if(newIndex==3&&Number($(“#age-2”).val())<18)
{
返回false;
}
//如果用户返回(清理)某些情况下需要
如果(当前索引<新索引)
{
//删除错误样式的步骤
form.find(“.body:eq(“+newIndex+”)label.error”).remove();
form.find(“.body:eq(“+newIndex+”).error”).removeClass(“error”);
}
form.validate().settings.ignore=“:disabled,:hidden”;
返回表单.valid();
},
onStepChanged:函数(事件、当前索引、优先级索引)
{
//用于在用户年龄足够大时跳过“警告”步骤。
if(currentIndex==2&&Number($(“#age-2”).val())>=18)
{
表格.步骤(“下一步”);
}
//用于跳过“警告”步骤,如果用户年龄足够大,并且希望执行上一步。
如果(currentIndex==2&&PrioriIndex==3)
{
表格、步骤(“先前”);
}
},
onFinishing:函数(事件、当前索引)
{
form.validate().settings.ignore=“:disabled”;
返回表单.valid();
},
onFinished:函数(事件、当前索引)
{
警报(“已提交!”);
}
}).验证({
errorPlacement:函数errorPlacement(error,element){element.before(error);},
规则:{
确认:{
equalTo:#密码-2”
}
}
});
账户
帐户信息
用户名*
密码*
确认密码*
(*)强制性

轮廓 配置文件信息 名字* 姓* 电子邮件* 地址 年龄(如果年龄小于18岁,则会显示警告步骤)* (*)强制性

警告 你太年轻了 请走开;-)

完成 条款和条件 我同意这些条款和条件。
如果你还没有找到答案,你需要基本的CSS


真正奇怪的是CSS不在正态分布,也没有在Steps文档中提及CSS,除了有用的修改,但没有基本的CSS。我以前从未遇到过这种情况。

您需要更改以下内容:

 $("#wizard").steps();           

        var form = $("#example-advanced-form").show();

        form.steps({
            headerTag: "h3",
为此: var form=$(“#示例高级表单”).show()


谢谢你的回复,但我不得不尝试一些不同的方法。如果你使用了Jquery步骤的替代方法,我会很感兴趣。我看过了,但有点痛。您是在使用替代方案,构建自己的解决方案,还是只是勉强接受?
        $("#wizard").steps({
            headerTag: "h3",