I'm building a little site at the moment and wanted to use some of the Bootstrap parts from Initialzr, specifically the tabs. I've currently tried using the example code provided by the Bootstrap project (http://twitter.github.com/bootstrap/javascript.html#tabs) and a few tweaks but get 'undefined is not a function' on load.
The JS files are preloaded in the right order (jQuery, libs/bootstrap/*, my script.js file/the script mixed in the html), standard jQuery commands (hide etc) all work fine so it doesn't appear to be related to the noConflict() option.
What else do I need to check?
This question is related to
javascript
jquery
ruby-on-rails
twitter-bootstrap
I actually managed to work out what I was doing wrong (and it was my fault).
I'm used to using pre-jQuery Rails, so when I included the Bootstrap JS files I didn't think that including the version of jQuery bundled with them would cause any issues, however when I removed that one JS file everything started working perfectly.
Lesson learnt, triple check which JS files are loaded, see if there's any conflicts.
make sure you're using the newest jquery, and problem solved
I met this problem with this code:
<script src="/scripts/plugins/jquery/jquery-1.6.2.min.js"> </script>
<script src="/scripts/plugins/bootstrap/js/bootstrap.js"></script>
After change it to this:
<script src="/scripts/plugins/jquery/jquery-1.7.2.min.js"> </script>
<script src="/scripts/plugins/bootstrap/js/bootstrap.js"></script>
It works fine
Probably is the use of the "on" event that Bootstrap use a lot and was inserted at jQuery 1.7 http://api.jquery.com/on/
This can also be caused if you include bootstrap.js
before jquery.js
.
Others might have the same problem I did.
Include jQuery
before bootstrap
.
We can try by using latest jQuery library. I got the same issue. I used jQuery-1.4.2.min before and getting the error. After that I used version 1.9.1 and it works. Thanks
Source: Stackoverflow.com