Bootstrap javascript question

2 replies
How to connect bootstrap with javascript? Im trying to add a javascript tooltip but it didnt work..

Im trying to make this code work:
Code:
<a href="#" rel="tooltip" title="first tooltip">hover over me</a>
All the .css and javascript files are already included.
I know Im missing some but I cant figure out what it is.

If you can give a simple example that would be very helpful.

Thanks
#bootstrap #javascript #question
  • Profile picture of the author SteveSRS
    are you talking about some package called 'bootstrap' or are you talking about bootstrapping js? Second one is automatically if you included all needed JS correctly..

    Using qtip for example will just do that automatically by the js scripts included in the head section. Of course you will need to not just include the source js' for the tooltip package but also the code to initialize it (bootstrap as you call it; this is not really a term used for JS but well for the definition of the word it is correct). Usually in the js code to initialize the tooltip you also indicate a (div) container id. If you didn't do this it won't work of course.
    {{ DiscussionBoard.errors[6578073].message }}
  • Profile picture of the author Workman
    Originally Posted by kojakeugenio View Post

    How to connect bootstrap with javascript? Im trying to add a javascript tooltip but it didnt work..
    I think you're talking about the Bootstrap template by Twitter, right?

    The good news is that you've already done most of the work, you just need to tell the browser through Javascript that you want to use that link as a tool tip. Have a look at the example on their documentation. In your particular case, all you would need to do is pop the following somewhere on your page or included js file.

    Code:
    // When the DOM has loaded...
    $(document).ready(function(){
      // Find all elements with rel="tooltip" and initialize Bootstrap's tooltip
      $('[rel="tooltip"]').tooltip();
    });
    Have fun!
    {{ DiscussionBoard.errors[6590276].message }}

Trending Topics