1

I'm trying to get tabs working on my app, and following the Bootstrap docs to set them up results in an error: Uncaught TypeError: Object [object Object] has no method 'tab' . I have a JSFiddle of the problem code: Not Working Fiddle


A little more info, which could be relevant: my app, built using Symfony, is compiling Bootstrap with Less, hence needing to use my own Bootstrap resources for the Fiddle example. There could be a problem with the compiling that's causing this, but I do see the Tab javascript code in there...


The HTML:

<div class="container">
  <div class="row">
    <ul id="campaignTabs" class="nav nav-tabs">
      <li class="active"><a href="#tasks" data-toggle="tab">Tasks</a></li>
      <li><a href="#schedule" data-toggle="tab">Schedule</a></li>
      <li><a href="#upgrade" data-toggle="tab">Upgrade</a></li>
    </ul>
    <div class="tab-content">
      <div class="tab-pane fade in active" id="tasks">
        Tab 1
      </div>
      <div class="tab-pane fade" id="schedule">
        Tab 2
      </div>
      <div class="tab-pane fade" id="upgrade">
        Tab 3
      </div>
    </div>
  </div>
</div>

The JS:

$('#campaignTabs a').click(function (e) {
    e.preventDefault();
    $(this).tab('show');
});

Any help would be appreciated!


EDIT: My original link was accidentally using links to local resources, so naturally that wasn't working! I updated to using resources from Dropbox, so hopefully those are working now.

3 Answers 3

4

You are miss the CSS and JS files. I update your jsfidle at http://jsfiddle.net/LS37A/3/ to fix your problem by point to official bootstrap CSS and JS at http://getbootstrap.com/getting-started/#download-cdn

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script>
Sign up to request clarification or add additional context in comments.

1 Comment

Oops! My app (using Symfony) is compiling bootstrap with less, so I was attempting to reference copies of the compiled TWBS code. The issue is still happening with my local code using the compiled files, and oddly JSFiddle didn't give me the same loading error. I'll put up a new Fiddle with properly sourced copies of my compiled TWBS code.
1

as answered in the chat, your compiled bootstrap.js is faulty. Either use the prebuilt js in dist folder, or make sure your compiler is including all required .js libs.

1 Comment

Definitely a problem with the compiled bootstrap.js. Not sure why, but I guess I don't really need to care since I can use the pre-compiled dist version included with the package.
1

Working fiddle Demo with added live links of bootstrap library.


Problem with your fiddle

links are dead see-

http://kiomedia.virt/app_dev.php/js/93eb36e_bootstrap_1.js

http://kiomedia.virt/app_dev.php/css/fabf8b3_bootstrap_1.css

enter image description here

1 Comment

See edit in the question regarding my Bootstrap resources, thanks!

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.