【问题标题】:Specific Javascript function not recognized? (ASP.NET MVC) JS/CSS/HTML无法识别特定的 Javascript 函数? (ASP.NET MVC) JS/CSS/HTML
【发布时间】:2020-11-27 01:04:43
【问题描述】:

我正在尝试使用我在 freefrontend 上从 Internet 上找到的模板在我的程序中使用表单向导。但是,程序中没有使用正在使用的一个 JS 函数。如 chrome 上的控制台所示,我收到以下异常:

我的程序代码如下(HTML/JS)

@{
    ViewBag.Title = "LoginSignUp";
    Layout = "~/Views/Shared/LoginSignUp.cshtml";
    @Scripts.Render("~/bundles/jquery")
}
<link href="https://res.cloudinary.com/dxfq3iotg/raw/upload/v1581152092/smartwizard/smart_wizard.min.css" rel="stylesheet" type="text/css" />
<link href="https://res.cloudinary.com/dxfq3iotg/raw/upload/v1581152091/smartwizard/smart_wizard_theme_arrows.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="https://res.cloudinary.com/dxfq3iotg/raw/upload/v1581152197/smartwizard/jquery.smartWizard.min.js"></script>
<div class="container">
    <div class="row d-flex justify-content-center mt-200"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal"> Launch multistep Wizard </button> </div> <!-- Modal -->
    <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel">Smart Wizard modal</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button>
                </div>
                <div class="modal-body">
                    <div id="smartwizard">
                        <ul>
                            <li><a href="#step-1">Step 1<br /><small>Account Info</small></a></li>
                            <li><a href="#step-2">Step 2<br /><small>Personal Info</small></a></li>
                            <li><a href="#step-3">Step 3<br /><small>Payment Info</small></a></li>
                            <li><a href="#step-4">Step 4<br /><small>Confirm details</small></a></li>
                        </ul>
                        <div class="mt-4">
                            <div id="step-1">
                                <div class="row">
                                    <div class="col-md-6"> <input type="text" class="form-control" placeholder="Name" required> </div>
                                    <div class="col-md-6"> <input type="text" class="form-control" placeholder="Email" required> </div>
                                </div>
                                <div class="row mt-3">
                                    <div class="col-md-6"> <input type="text" class="form-control" placeholder="Password" required> </div>
                                    <div class="col-md-6"> <input type="text" class="form-control" placeholder="Repeat password" required> </div>
                                </div>
                            </div>
                            <div id="step-2">
                                <div class="row">
                                    <div class="col-md-6"> <input type="text" class="form-control" placeholder="Address" required> </div>
                                    <div class="col-md-6"> <input type="text" class="form-control" placeholder="City" required> </div>
                                </div>
                                <div class="row mt-3">
                                    <div class="col-md-6"> <input type="text" class="form-control" placeholder="State" required> </div>
                                    <div class="col-md-6"> <input type="text" class="form-control" placeholder="Country" required> </div>
                                </div>
                            </div>
                            <div id="step-3" class="">
                                <div class="row">
                                    <div class="col-md-6"> <input type="text" class="form-control" placeholder="Card Number" required> </div>
                                    <div class="col-md-6"> <input type="text" class="form-control" placeholder="Card Holder Name" required> </div>
                                </div>
                                <div class="row mt-3">
                                    <div class="col-md-6"> <input type="text" class="form-control" placeholder="CVV" required> </div>
                                    <div class="col-md-6"> <input type="text" class="form-control" placeholder="Mobile Number" required> </div>
                                </div>
                            </div>
                            <div id="step-4" class="">
                                <div class="row">
                                    <div class="col-md-12"> <span>Thanks For submitting your details with BBBootstrap.com. we will send you a confirmation email. We will review your details and revert back.</span> </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $(document).ready(function () {

        $('#smartwizard').smartWizard({
            selected: 0,
            theme: 'arrows',
            autoAdjustHeight: true,
            transitionEffect: 'fade',
            showStepURLhash: false,

        });

    });
</script>

CSS 已被放置在一个单独的文件中,并且看起来工作正常。

关于为什么会这样的任何建议?

【问题讨论】:

标签: javascript html jquery asp.net model-view-controller


【解决方案1】:

您只需要在其他库之前包含 jQuery 库。

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

【讨论】:

    猜你喜欢
    • 2011-07-10
    • 2017-06-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多