Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 3 Tooltip over Glyphicon

Not sure if this even possible, I am trying to invoke a tooltip over a glyphicon inside an input group, my code (which does not work) is;

<div class="input-group"> <input type="text" class="form-control" name="security" id="security"><span class="input-group-addon"><span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-container: 'body' title="" data-original-title="Security Code"></span></span> </div> 

I'm using Bootstrap 3, and the latest version of jQuery.

like image 714
user2449026 Avatar asked Oct 30 '13 16:10

user2449026


People also ask

How do I change the tooltip position in bootstrap?

How to position the tooltip - auto | top | bottom | left | right. When auto is specified, it will dynamically reorient the tooltip. When a function is used to determine the placement, it is called with the tooltip DOM node as its first argument and the triggering element DOM node as its second.

How do I show top tooltip?

HTML: Use a container element (like <div>) and add the "tooltip" class to it. When the user mouse over this <div>, it will show the tooltip text. The tooltip text is placed inside an inline element (like <span>) with class="tooltiptext" .

How do I add icons to tooltip?

Answer: Use the Bootstrap . tooltip() method First of all add the data attributes data-toggle="tooltip" and data-original-title="Text" to the icon elements and finally initialize the tooltips using the Bootstrap's . tooltip() method.

What is rel tooltip?

Tooltips are just cosmetic though. Not css style but just a bit of JS to change how a title attribute is presented. The "rel" attribute is meant to be used to tell a bot (such as google) about the nature of a link.


1 Answers

You can get a simple tooltip over the glyphicon using the title attribute (which is blank in your example).

title="info" 

Working code

 // add this in your js  // all the glyphicons having the class "my-tooltip" will show a tooltip if "title" attribute is present  $(".my-tooltip").tooltip();   <span class='glyphicon glyphicon-info-sign my-tooltip' title="here goes the tooltip text"></span> 
like image 58
Dennis Avatar answered Sep 16 '22 18:09

Dennis