Having trouble adding a tooltip to a glyphicon
.
The JSFiddle example provided does not work for me as I am using jQuery
to create the HTML
elements like this:
var trashIcon = $('<i>').addClass('glyphicon glyphicon-trash');
How can I modify the code to match the desired output?
var trashToolTip = $('<a>').addClass=('my-tool-tip').attr({ data-toggle:"tooltip" data-placement:"left" title:"Delete" });
CSS:
a.my-tool-tip, a.my-tool-tip:hover, a.my-tool-tip:visited {
color: black;
}
EDIT:
In the provided JSFiddle link:
The class CANNOT be tooltip...
The HTML representation of var trashIcon
is:
`<i class='glyphicon glyphicon-trash'></i>`
I want the HTML version of var trashToolTip
to look like this:
<a class='my-tool-tip' data-toggle="tooltip" data-placement="left" title="delete"></a>
So that it should appear as follows in the code:
<a class='my-tool-tip' data-toggle="tooltip" data-placement="left" title="delete">
<i class='glyphicon glyphicon-trash'></i>
</a>