Chris H
Chris H

Reputation: 125

Using local jquery with bootstrap

I am developing a site which will work from a local server not connected to the internet, so need to use a local copy of jquery on my site. When testing (while internet-connected) it works fine, but using the local copy I get lots of errors saying "Error: jquery is undefined" and "Error: bootstrap requires jquery".

I have looked at this answer but it doesn't solve my problem.

I have checked the downloaded copies of jquery-1.11.1.js and jquery-1.11.1.min.js - they look ok as far as I can tell. I don't know what else to look at.

In the code below I just comment/uncomment the appropriate lines to enable remote/local jquery..

<!-- jQuery (necessary for Bootstrap's JavaScript plugins)-->
<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>-->  
<script src="js/jquery-1.11.1.min.js" type="text/javascript"></script>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css"/>
<link href="css/browserfixes.css" rel="stylesheet" type="text/css" />
....etc more css

<script src="js/bootstrap.min.js"></script>
<script src="js/moment.min.js" type="text/javascript"></script>
....etc more js

Any suggestions welcome - I have wasted ages trying to figure this out.

Upvotes: 1

Views: 7559

Answers (4)

Chris H
Chris H

Reputation: 125

I found the answer - the files were there in the right places, but for some reason the web publishing software had created the jquery js files with different permissions - I'm still investigating why. But the upshot is that setting the correct permissions solves the problem. Thanks all those who suggested solutions. It's one of those slap-the-forehead moments.

Upvotes: 1

Harutyun Abgaryan
Harutyun Abgaryan

Reputation: 2023

Use this

    <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" />
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css" />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

And see your true jquery library path

Upvotes: 0

specialone
specialone

Reputation: 130

I got a feeling that your js/jquery-1.11.1.min.js is not in the folders.

Maybe change the path to ../js/jquery-1.11.1.min.js Or check whether the path is right.

From the codes you pasted from top down to bottom. It should not have any issue.

  1. jQuery
  2. Bootstrap

Upvotes: 0

benjasHu
benjasHu

Reputation: 354

Try to put your all of your css links before of the scripts.

Upvotes: 1

Related Questions