Bootstrap's javascript works locally but not when deployed to a server

dialex picture dialex · Aug 27, 2012 · Viewed 32.5k times · Source

I downloaded the barebone example of Twitter's bootstrap and customized it. I tested it locally (with WAMP server) and everything works perfectly, both the CSS and the JScript.

I uploaded the files to my webhosting service and the JScript just doesn't work. I noticed it because dropdown boxes stopped working.

I searched and found other persons with the same problem but they all are using ruby and I'm not. Just the play CSS+JScript provided by bootstrap. Besides they said the solution was to include the bootstrap.js first and then the jquery.js. Well I tried it and it didn't work, I even included the not minified .js and still it didn't work.

I'm using the same browser (Chrome) for local and remote testing. I also tried different hosting services and the problem occurred in both.

Help is much appreciated.


Other similar questions:

Answer

Hoff picture Hoff · Aug 27, 2012

The issue might be that you load boostrap.js before jQuery. Locally your browser may be using a cached copy of Jquery, so it works there but not on your live site. Try fixing it by switching those two lines in your code:

<script src="/code4pt/styles/js/bootstrap.js"></script>
<script src="/code4pt/styles/js/jquery.js"></script>