javascript - How to bind tooltips to this html elements -


i have html element when console.log them in code.

<span id="stamps[12]" class="stamps value  widget-data  tooltipstered" data-value="0.00" data-toggle="tooltip">0.00</span> 

this how call tooltipster.but not working.

$($(htmldata)).find('[data-toggle="tooltip"]').each(function(v){                 console.log(this);                  $(this).tooltipster();              }); 

if want content of tooltipster taken data-* attribute, need set inside tooltipster constructor (use content attribute).

here example:

$('[data-toggle="tooltip"]').each(function(v){    console.log(this);    $(this).tooltipster({      content: $(this).data('value')    });  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tooltipster/3.3.0/css/tooltipster.min.css">  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tooltipster/3.3.0/js/jquery.tooltipster.min.js"></script>  <span id="stamps[12]" class="stamps value  widget-data  tooltipstered" data-value="0.00" data-toggle="tooltip">0.00</span>  <br />  <span id="stamps[13]" class="stamps value  widget-data  tooltipstered" data-value="12.23" data-toggle="tooltip">12.23</span>


Comments