Bind bootstrap tooltip on dynamic elements

It is pretty simple to bind a tooltip with elements. Generally, it happends when we works with dynamic elements than it creates problem for some js functions. Tooltip is on of them that never works with dynamic element. So for overcoming that problem we have to bind the tooltip on dynamic elements.

Example.1 :

$('body').tooltip({
    selector: '.current-div'
});

<html>
 <head>
  ..................
  ..................
</head>
<body>
  <div class="current-div'" data-toggle="tooltip" title="I am tooltip.">Hover over me</div>
</body>
</html>

Example.2:

$('body').tooltip({
    selector: '[data-toggle]',
    position: 'top'
});

<html>
 <head>
..................
..................
</head>
<body>
  <a href="#" data-toggle="tooltip" data-placement="top" title="Favorite"><i class="fa fa-heart-o"></i></a>
</body>
</html>



Post a Comment

2 comments:

  1. Eminem, also known as Marshall Mathers, is one of the most commercially successful rappers of all time, with more than 100 million albums sold worldwide. He is one of the richest rappers in the world, with an estimated net worth of $210 million. Read in Eminem net worth.

    ReplyDelete
  2. For the excellent company Begin with the internet site, the customer service over the cell phone, to the detailed care they deliver in your presence
    leather jacket

    ReplyDelete