jQuery 获取错误:未捕获的类型错误:未定义不是函数 bootstrap.js:29(匿名函数)bootstrap.js:29(匿名函数)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14480616/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 13:37:20  来源:igfitidea点击:

Getting error : Uncaught TypeError: undefined is not a function bootstrap.js:29 (anonymous function) bootstrap.js:29 (anonymous function)

jqueryhtmltwitter-bootstrapvisualforce

提问by iJade

I'm getting the following error

我收到以下错误

    Uncaught TypeError: undefined is not a function bootstrap.js:29
(anonymous function) bootstrap.js:29
(anonymous function)

in my visualforcepage in the developer console.I'm trying to integrate twitter-bootstrapin Visualforce

在我visualforce的开发者页面console.I'm试图整合twitter-bootstrapVisualforce

Here is the complete visual force code

这是完整的视觉力代码

    <apex:page standardStylesheets="false" showHeader="false" sidebar="false">
    <!-- Begin Default Content REMOVE THIS -->

    <head>
        <apex:stylesheet value="{!URLFOR($Resource.bootstrap, 'bootstrap/css/bootstrap.css')}"
        />
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"
        type="text/javascript"></script>
        <apex:stylesheet value="{!URLFOR($Resource.bootstrap, 'bootstrap/css/bootstrap.min.css')}"
        />
        <apex:includeScript value="{!URLFOR($Resource.bootstrap, 'bootstrap/js/bootstrap.js')}"
        />
        <apex:includeScript value="{!URLFOR($Resource.bootstrap, 'bootstrap/js/bootstrap.min.js')}"
        />

    </head>

    <body>
        <div id="force">
            <div class="input-append" align="center" style="padding-top:20px;">
                <input type="text" name="q" class="span2 search-query" placeholder="Snipp or Tag"
                />
                <button type="submit" class="btn">Search</button>
                <div class="pull-right">
                    <button class="btn btn-primary active"><i class="icon-white icon-plus"></i> A</button>
                    kjhkjdfgdgdfgdfgdfgdfgdgfgdfg
                    <button class="btn btn-primary active"
                    style="margin-right:50px;"><i class="icon-white icon-bullhorn"></i> Fee</button>
                </div> 
            </div>
        </div>
    </body>
</apex:page>

Here is a link to the page jady-developer-edition.ap1.force.com

这是页面的链接 jady-developer-edition.ap1.force.com

Can any one throw some light on what might be wrong.

任何人都可以对可能出现的问题有所了解。

回答by anderssonola

You need to include jquery before including the bootstrap js-file.

在包含引导程序 js 文件之前,您需要包含 jquery。

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript" src="/resource/1358914798000/bootstrap/bootstrap/js/bootstrap.js"></script>

note that you don't need both bootstrap.js and bootstrap.min.js

请注意,您不需要 bootstrap.js 和 bootstrap.min.js

回答by Rahul Nikate

This can be caused if you are including bootstrap.jsbefore jquery.js. So make sure you are including jQuerybefore bootstrap.

如果您包含bootstrap.jsbefore ,则可能会导致这种情况jquery.js。因此,请确保您jQuery之前包含bootstrap.

There are other things to check.

还有其他事情要检查。

Also one more possible case is, there could be multiple instances of jQuery in the page. So search for a duplicate version of jQuery and remove them if there is any.

另一种可能的情况是,页面中可能有多个 jQuery 实例。因此,搜索重复版本的 jQuery 并删除它们(如果有)。

Find below link for more information.

查找以下链接以获取更多信息。

Avoiding Conflicts with Other Libraries

避免与其他库发生冲突