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>

About the author

Being the CEO and Founder of ClecoTech International, Mr. Ashish Prajapati is dedicated towards his aim of mentoring young startups into a full-fledged businesses. He is helping startups from America, Europe, India, and various other countries through proper guidance and the use of latest technologies to develop their innovation and ideas into definite realities.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *