0

In my ASP.NET Core RC2 app in VS2015, I'm using following example of Collapsible List Groups that uses the following Javascript files. The example works fine in Visual Studio if I use the following scripts. But when I use the default javascipts installed in ASP.NET Core app (namely, <script src="lib/bootstrap/dist/js/bootstrap.min.js"></script> and <script src="lib/jquery/dist/jquery.min.js"></script>) the same example does not work. Are the above default Javascripts different than the following. What can I add to these defaults Javascripts to make the same example work? :

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

UPDATE The location of the above example html file in my ASP.NET Core project is as shown below and the header of my html file looks like the following:

<html>
<head>
    <meta charset="utf-8" />
    <link href="lib/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />
    <script src="lib/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="lib/jquery/dist/jquery.min.js"></script>
    <title>SideBar demo</title>
</head>
<body>
...
</body>
</html>

My Html file location in ASP.NET Core project in VS2015:

enter image description here

My bower.json is as follows:

{
  "name": "asp.net",
  "private": true,
  "dependencies": {
    "jquery": "2.2.3",
    "jquery-validation": "1.15.0",
    "jquery-validation-unobtrusive": "3.2.6",
    "bootstrap": "3.3.6"
  },
  "resolutions": {
    "jquery": ">=1.8",
    "jquery-validation": "1.15.0"
  }
}
1
  • 1
    Check for errors in console and you will see where browsers are looking for files. Commented Jun 24, 2016 at 18:07

3 Answers 3

1

No, both are same. The first two links are downloaded bootstrap and jquery files and the rest are the online versions of the bootsrap and jquery.

Sign up to request clarification or add additional context in comments.

3 Comments

But the same exmple is not working with the downloaded bootstrap and jquery files. I've added an UPDATE section to my post for further clarity.
What is not working? Did F12 give you any error information?
Inspect the page to get any information regarding the problem by F12 or Right click->Inspect.
0

The scripts are probably outdated, try to update the bower.config file.

More info: https://docs.asp.net/en/latest/client-side/bower.html

5 Comments

I had already gone through the link. It only shows how to add css or js files. I'm using the latest version ASP.NET Core CR2 that already should have the latest default js and css files.
Which version jquery and bootstrap is using in bower.config?
Don't know if bower.config exists in VS2015 projects and what it is. But I've added UPDATE 2 for you to show bower.json file.
It exists, it's in the root folder of your project. EDIT: it's not bower.config, it's bower.json, my mistake.
Update jquery dependency to version to 1.12.2, it should work.
0

I've resolved the issue as follows:

  1. I used Chrome Developer too to follow suggestion from this user to look into the console and found the following error message: Error: Bootstrap's JavaScript requires jQuery
  2. Then I followed this user's suggestion to load jquery.js file before loading bootstrap files

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.