Bootstrap tooltip is not working

I am adding tooltip but its not working, and how I can positioning it thru jquery/js like (left, right, top, bottom)

please help me out where i am doing something wrong…

Thanks…

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sticky footer &middot; Twitter Bootstrap</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSS -->
<link href="../assets/css/bootstrap.css" rel="stylesheet">
<link href="../assets/css/ticket-style.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="../assets/css/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="../assets/css/jquery-ui.theme.css">
<link href="../assets/css/bootstrap-responsive.css" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
      <script src="../assets/js/html5shiv.js"></script>
    <![endif]-->
<!-- Fav and touch icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
<link rel="shortcut icon" href="../assets/ico/favicon.png">
<style>
.typeahead, .tt-query, .tt-hint {
    width: 280px;
}
</style>

</head>
<body>
<!-- Part 1: Wrap all page content here -->
<div id="wrap">
  <!-- Fixed navbar -->
  <div class="navbar">
    <div class="navbar-inner">
      <div class="container">
        <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
        <a class="brand" href="#">Project name</a>
        <div class="nav-collapse collapse">
          <ul class="nav">
            <li class="active"><a href="#">Home</a></li>
            <li><a href="#about">About</a></li>
            <li><a href="#contact">Contact</a></li>
            <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
              <ul class="dropdown-menu">
                <li><a href="#">Action</a></li>
                <li><a href="#">Another action</a></li>
                <li><a href="#">Something else here</a></li>
                <li class="divider"></li>
                <li class="nav-header">Nav header</li>
                <li><a href="#">Separated link</a></li>
                <li><a href="#">One more separated link</a></li>
              </ul>
            </li>
          </ul>
        </div>
        <!--/.nav-collapse -->
      </div>
    </div>
  </div>
  <!-- Begin page content -->
  <div class="container-fluid nopadDiv">
    <div class="row-fluid">
      <div class="span3 leftNavContent ">
        <ul class="nav nav-list nav-list_">
          <div class="quickLinks">
            <div class="LastloginInfo"> <strong>Last Login</strong> 9/22/2014 02:52:39 AM </div>
            <ul>
              <li><a href="#" class="current">Manage Tickets (198)</a></li>
            </ul>
          </div>
        </ul>
      </div>
      <div class="span9 breadcrumbwrap">
            <ul class="breadcrumb">
                <li><a href="#">Search</a> <span class="divider">/</span></li>
                <li class="active">Search Account</li>
            </ul>
      </div>
      
      
        <div class="span9">
            <div class="grayBox">
                <div class="whiteBox clearfix">
                    <form class="form-horizontal">
                        <div class="control-group">
                          <label class="control-label" for="textinput">Customer Name</label>
                          <div class="controls">
                            <input id="myTypeahead" name="CustomerName" placeholder="Customer Name" class="input-xlarge" type="text">
                          </div>
                        </div>
                        
                        <div class="control-group">
                          <label class="control-label" for="textinput">Account No.:</label>
                          <div class="controls">
                            <input id="accountNo" name="AccountNo" placeholder="Account No." class="input-xlarge" type="text">
                            <i class="icon-info-sign ml5" data-toggle="tooltip" title="first tooltip"></i>
                          </div>
                        </div>
                        
                        <div class="control-group">
                          <label class="control-label" for="textinput">Realm:</label>
                          <div class="controls">
                            <input id="realm" name="Realm" placeholder="Realm" class="input-xlarge" type="text">
                          </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
      
      
      
  </div>
</div> <!-- main container-fluid-->
<div id="push"></div>
</div>
<!-- wrap -->
<div id="footer">
  <div class="container">
    <p class="muted credit">Example courtesy <a href="http://martinbean.co.uk">Martin Bean</a> and <a href="http://ryanfait.com/sticky-footer/">Ryan Fait</a>.</p>
  </div>
</div>
<!-- Le javascript
    ================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../assets/js/jquery.js" type="text/javascript"></script>
<script src="../assets/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../assets/js/bootstrap-tooltip.js" type="text/javascript"></script>
<script src="../assets/js/bootstrap-typeahead.js" type="text/javascript"></script>

<script type="text/javascript" src="../assets/js/jquery_ui/jquery-ui.js"></script>

<script type="text/javascript">
$(function(){
    // Define source array
    var countries = ["William Pecham", "William Traver Gallery", "William Chapman", "William Morgan", "William Niestar", "William Collins", "William Furr", "Rahul Bhingare"];
    // Initializes typeahead
    $("#myTypeahead").typeahead({
        source: countries
    }); 
});

$(document).ready(function(){
    alert('tooltip alert');
    $('#element').tooltip('show')
});

</script>

</body>
</html>

Please edit your post. Highlight all your code and in the editor box, the toolbar area, you will see a button that looks like this </> . Please click that button after highlighting your code. Then save your edit.

Where in the html is there an element with an id of element?

$('#element').tooltip('show')

That would apply to this:

<div id="element"></div>

Make sure you target the element you want to have the tooltip correct;y (use a class if you have multiple tooltips).

You can style the default bootstrap tooltip by modifying the rules through a parent of the tooltip (never change bootstrap rules directly).

You don;t really want to use ‘show’ as the parameter as that will show it by default.

Here is a working example:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bootstrap, from Twitter</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<!-- Le styles -->
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet">
<style></style>
<style type="text/css">
/* Sticky footer styles
  -------------------------------------------------- */

  html,  body {
	height: 100%;/* The html and body elements cannot have any padding or margin. */
  }
/* Wrapper for page content to push down footer */
  #wrap {
	min-height: 100%;
	height: auto !important;
	height: 100%;
	/* Negative indent footer by it's height */
    margin: 0 auto -60px;
}
/* Set the fixed height of the footer here */
  #push,  #footer {
	height: 60px;
}
#footer {
	background-color: #f5f5f5;
}

  /* Lastly, apply responsive CSS fixes as necessary */
  @media (max-width: 767px) {
#footer {
	margin-left: -20px;
	margin-right: -20px;
	padding-left: 20px;
	padding-right: 20px;
}
}
/* Custom page CSS
  -------------------------------------------------- */
  /* Not required for template or sticky footer method. */

  #wrap > .container {
	padding-top: 60px;
}
.container .credit {
	margin: 20px 0;
}
code {
	font-size: 80%;
}
.tooltip-test{
	clear:both;
	background:#ccc;	
}
</style>
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet">

<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
      <script src="http://getbootstrap.com/2.3.2/assets/js/html5shiv.js"></script>
    <![endif]-->

<!-- Fav and touch icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="http://getbootstrap.com/2.3.2/assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://getbootstrap.com/2.3.2/assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="http://getbootstrap.com/2.3.2/assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="http://getbootstrap.com/2.3.2/assets/ico/apple-touch-icon-57-precomposed.png">
<link rel="shortcut icon" href="http://getbootstrap.com/2.3.2/assets/ico/favicon.png">
</head>

<body>
<div id="wrap"> 
		
		<!-- Fixed navbar -->
		<div class="navbar">
				<div class="navbar-inner">
						<div class="container">
								<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
								<a class="brand" href="#">Project name</a>
								<div class="nav-collapse collapse">
										<ul class="nav">
												<li class="active"><a href="#">Home</a></li>
												<li><a href="#about">About</a></li>
												<li><a href="#contact">Contact</a></li>
												<li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
														<ul class="dropdown-menu">
																<li><a href="#">Action</a></li>
																<li><a href="#">Another action</a></li>
																<li><a href="#">Something else here</a></li>
																<li class="divider"></li>
																<li class="nav-header">Nav header</li>
																<li><a href="#">Separated link</a></li>
																<li><a href="#">One more separated link</a></li>
														</ul>
												</li>
										</ul>
								</div>
								<!--/.nav-collapse --> 
						</div>
				</div>
		</div>
		
		<!-- Begin page content -->
		<div class="container-fluid">
				<div class="row">
						<div class="span3 leftNavContent">
								<ul class="nav nav-list nav-list_">
										<div class="quickLinks">
												<div class="LastloginInfo"> <strong>Last Login</strong> 9/22/2014 02:52:39 AM </div>
												<ul>
														<li><a href="#" class="current">Manage Tickets (198)</a></li>
														<li><a href="#">Support Tickets</a></li>
														<li><a href="#">Billing Tickets</a></li>
														<li><a href="#">Order Tickets</a></li>
														<li><a href="#">Ticket Reports</a></li>
												</ul>
										</div>
								</ul>
						</div>
						<div class="span9">
								<ul class="breadcrumb">
										<li><a href="#">Home</a> <span class="divider">/</span></li>
										<li><a href="#">Library</a> <span class="divider">/</span></li>
										<li class="active">Data</li>
								</ul>
								<div class="tooltip-test">
								<p>Test Tooltip <a class="myTip" href="#" data-toggle="tooltip" data-trigger="hover"  title="first tooltip">hover over me</a></p>
								
								</div>
								
						</div>
				</div>
				<!-- ROW --> 
		</div>
		<!-- container -->
		
		<div id="push"></div>
</div>
<!-- wrap -->

<div id="footer">
		<div class="container">
				<p class="muted credit">Example courtesy <a href="http://martinbean.co.uk">Martin Bean</a> and <a href="http://ryanfait.com/sticky-footer/">Ryan Fait</a>.</p>
		</div>
</div>

<!-- Le javascript
    ================================================== --> 
<!-- Placed at the end of the document so the pages load faster --> 
<script src="http://getbootstrap.com/2.3.2/assets/js/jquery.js"></script> 
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-transition.js"></script> 
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-alert.js"></script> 
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-modal.js"></script> 
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-dropdown.js"></script> 
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-scrollspy.js"></script> 
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-tab.js"></script> 
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-tooltip.js"></script> 
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-popover.js"></script> 
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-button.js"></script> 
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-collapse.js"></script> 
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-carousel.js"></script> 
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-typeahead.js"></script>
<script>
$(document).ready(function(){
	$('.myTip').tooltip()
});
</script>
</body>
</html>

The JS is as follows:

<script>
$(document).ready(function(){
	$('.myTip').tooltip()
});
</script>

Then the html looks like this:

<div class="tooltip-test">
 <p>Test Tooltip <a class="myTip" href="#" data-toggle="tooltip" data-trigger="hover"  title="first tooltip">hover over me</a>/p>
</div>

The text in the title becomes your tooltip text (title=“first tooltip”).

Notice the data attributes to identify the tooltip and to set its behaviour:
data-toggle="tooltip" data-trigger="hover"

thanks Paul,
you really a champ…

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.