twitter-bootstrap 引导 javascript 需要 jquery 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24107151/
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-10-21 20:55:17  来源:igfitidea点击:

bootstrap javascript requires jquery error

javascriptjquerytwitter-bootstrap

提问by user3719840

This is my .cshtml code

这是我的 .cshtml 代码

    <!DOCTYPE Html>
    <html>
        <head>
            <meta charset="utf-8" />
            <meta name="viewport" content="width=device-width" />
            <title>welcome</title>
            <link href="~/Content/bootstrap.css" rel="stylesheet" />
            <script src="~/Scripts/jquery-1.8.0.min.js"></script>
            <script src="~/Scripts/bootstrap.js"></script>
       </head>
       <body>...</body>
    </html>

Whenever I execute my code it gives the bootstrap requires jquery error. Please suggest what should I do to remove this error.

每当我执行我的代码时,它都会给出引导程序需要 jquery 错误。请建议我该怎么做才能消除此错误。

回答by Amit Joki

Make sure that the path is correct and points to jQuery version greater than 1.9

确保路径正确并指向大于 1.9 的 jQuery 版本

You are using 1.8 which is not compatible with bootstrap

您正在使用与引导程序不兼容的 1.8

Source:

来源:

https://github.com/twbs/bootstrap/blob/v3.1.1/bower.json

https://github.com/twbs/bootstrap/blob/v3.1.1/bower.json

回答by Joshua

Just as Amit Joki said, make sure you link points directly to the jquery file and the file name is spelt accordingly. Also ensure that you link jquery js script before you link to the bootstrap js script

正如 Amit Joki 所说,确保将点直接链接到 jquery 文件,并相应地拼写文件名。还要确保在链接到 bootstrap js 脚本之前链接 jquery js 脚本

<script src="path_to_script/jquery-1.8.0.min.js"></script>
<script src="path_to_script/bootstrap.js"></script>
<link href="path_to_script/bootstrap.css" rel="stylesheet" />