Uncaught TypeError: $(...).steps is not a function

Uncaught TypeError: $(...).steps is not a function

所以我在我的 bootstrap 模板中看到了非常漂亮的表单,我想在我的项目中使用它们。

我把我认为我们需要导入的所有必需文件都添加在代码的底部,所需文件位于正确的目录中,例如,jquery 步骤:C:\xampp\htdocs\rps\public\files\bower_components\jquery.steps\js\jquery.steps.js

'initialize-steps.js':

$("#practitioner-form").steps({
    headerTag: "h3",
    bodyTag: "fieldset",
    transitionEffect: "slideLeft",
    enablePagination: true,
    autoFocus: true,
    onFinished: function (event, currentIndex)
    {
        alert("Practitioner Added!");
    }
});

我的 HTML 多格式 (...) 文件被跳过了部分:

<div class="card-block">
        <div class="row">
            <div class="col-md-12">
                <div id="practitioner-form">
                    <form method="post" id="practitioner-form" action="#">
                        <h3>Practitioner</h3>
                        <fieldset>
                            <legend>Practitioner Information</legend>
                            <div class="form-group row">
                                <div class="col-lg-12">
                                    <label for="effective_date" class="block">{{trans('personalData.effectiveDate')}}</label>
                                </div>
                                <div class="col-lg-12">
                                    <input id="effective_date" name="effectiveDate" type="date" class="form-control required">
                                </div>
                            </div>

(...)


<link rel="stylesheet" type="text/css" href="/files/bower_components/jquery.steps/css/jquery.steps.css">
<!-- Required Jquery -->
<script src="/files/js/views/person/initialize-steps.js"></script>
<script src="/files/bower_components/jquery/js/jquery.min.js"></script>
<script src="/files/bower_components/jquery-ui/js/jquery-ui.min.js"></script>
<script src="/files/bower_components/popper.js/js/popper.min.js"></script>
<script src="/files/bower_components/bootstrap/js/bootstrap.min.js"></script>
<!--Forms - Wizard js-->
<script src="/files/bower_components/jquery.cookie/js/jquery.cookie.js"></script>
<script src="/files/bower_components/jquery.steps/js/jquery.steps.js"></script>
<script src="/files/bower_components/jquery-validation/js/jquery.validate.js"></script>

<script src="/files/js/modules/practitionerCompetence.js"></script>

当我尝试加载页面时仍然出现错误:Uncaught TypeError: $(...).steps is not a function有人知道如何修复它吗?

像这样订购 js 将您的脚本放在最后

<script src="/files/bower_components/jquery/js/jquery.min.js"></script>
<script src="/files/bower_components/jquery-ui/js/jquery-ui.min.js"></script>
<script src="/files/bower_components/popper.js/js/popper.min.js"></script>
<script src="/files/bower_components/bootstrap/js/bootstrap.min.js"></script>
<!--Forms - Wizard js-->
<script src="/files/bower_components/jquery.cookie/js/jquery.cookie.js"></script>
<script src="/files/bower_components/jquery.steps/js/jquery.steps.js"></script>
<script src="/files/bower_components/jquery-validation/js/jquery.validate.js"></script>

<script src="/files/js/modules/practitionerCompetence.js"></script>
<script src="/files/js/views/person/initialize-steps.js"></script>

jquery.steps.jsinitialize-steps.js

之后加载
<script src="/files/js/views/person/initialize-steps.js"></script>
....
<script src="/files/bower_components/jquery.steps/js/jquery.steps.js"></script>

您需要在 initialize-steps.js 之后加载

<script src="/files/bower_components/jquery.steps/js/jquery.steps.js"></script>
<script src="/files/js/views/person/initialize-steps.js"></script>
....