首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >对象[ Object ]没有方法'bootstrapValidator‘

对象[ Object ]没有方法'bootstrapValidator‘
EN

Stack Overflow用户
提问于 2014-08-05 15:41:47
回答 1查看 119关注 0票数 0

index.html

代码语言:javascript
复制
<script type="text/javascript" data-main="js/app/main.js" src="js/libs/require/require.2.1.14.min.js"></script>

main.js

代码语言:javascript
复制
require.config({
    baseUrl: "js/",
    paths: {
        bootstrap: "libs/bootstrap/bootstrap.min",
        bootstrapValidator: "libs/bootstrap/validator",
        jquery: "libs/jquery/jquery-1.9.0.min",
        jqueryui: "libs/jquery-ui-1.11/jquery-ui.min",
        modernizr: "libs/modernizr/modernizr.2.8.3.min",
        underscore: "libs/underscore/underscore",
        text: "libs/require/text"
    },
    shim: {
        jquery: {
            exports: "$"
        },
        bootstrapValidator: {
            deps: ["jquery"]
        }
    }
});

require([
    "bootstrap",
    "underscore",
    "bootstrapValidator",
    "text!/js/app/templates/index.html"], function(Bootstrap, _, BootstrapValidator, IndexTemplate) {
    "use strict";

    var App = {
        $el: $('#content-latch'),

        /*
         * initialize: constructor
         * @returns the instance
         */
        initialize: function() {

            // create an instance of the main form template
            var html = _.template($(IndexTemplate).html());

            // set the main el to the html
            this.$el.html(html);

            setTimeout(function() {
                $('#profileForm').bootstrapValidator({});
            }, 500);
        }

    };

    return App.initialize();
});

我已经读到线程标题是由jQuery被包含两次所引起的,但是我看不出上面的代码是如何产生的

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-08-05 16:26:31

您的jQuery包含错误的顺序:

代码语言:javascript
复制
 paths: {
        jquery: "libs/jquery/jquery-1.9.0.min",
        jqueryui: "libs/jquery-ui-1.11/jquery-ui.min",
        bootstrap: "libs/bootstrap/bootstrap.min",
        bootstrapValidator: "libs/bootstrap/validator",
        /*  jquery: "libs/jquery/jquery-1.9.0.min",
            jqueryui: "libs/jquery-ui-1.11/jquery-ui.min", */
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25142961

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档