1

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.

6
  • Check the view source of the page and ensure the path is correct or not? Commented Oct 4, 2014 at 12:43
  • 2
    check network tab in browser console , is file loading? Commented Oct 4, 2014 at 12:43
  • I checked the view source - it's the same as it is in the code, not sure why it would be different? I'm not sure what you mean by "check network tab in browser console" - can you explain? Commented Oct 4, 2014 at 13:21
  • A link would really help but otherwise, go back to basics: download a fresh copy of jquery-1.11.1.min.js and put it in the js folder with your bootstrap.min.js. It is either not in the folder or the name is wrong. Commented Oct 4, 2014 at 14:50
  • That's what I have already looked at numerous times and the first thing I thought too. It's in the same folder, with the name referenced. I even renamed it to just jq.js and used that in the reference - same issue. And that's after downloading a fresh copy. Commented Oct 6, 2014 at 15:02

4 Answers 4

1

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

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

1 Comment

I think the same as specialone said. Every Bootstrap plugin firstly throws that error if jQuery is undefined, so you are not loading jQuery properly because jQuery global var must exists before call Bootstrap's plugins. Try to change jQuery path to load.
1

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.

Comments

0

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

1 Comment

It is in the same folder - checked on the remote server. I also tried renaming it to just jq.js just in case it's something to do with the dashes, and modifying the reference accordingly. Same issue.
0

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

7 Comments

I tried that, but not sure what I'm supposed to be seeing. With both local and remote files neither shows any output on the web page. What should this show me?
"please see me error" - what does that mean please?
[JavaScript error] - Error: Bootstrap's JavaScript requires jQuery [debug line] - if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery")
if use "$" in your code change all simbol '$' to jQuery in your jquery code
I don't use it directly - bootstrap uses it, so I have no control over how it's used
|

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.