this is my div
<div class="classdiv">11</div>
<div class="classdiv">22</div>
<div class="classdiv">33</div>
<div class="classdiv">44</div>
<div class="classdiv">55</div>
<div class="classdiv">66</div>
i need to change this div text to tooltip using Jquery , because i can not change it manually , there are so many (http://getbootstrap.com/javascript/#tooltips). So that user cannot see the div's text first .When he hover this , text appear in tool tip . I know how to make tool tip ,
<div class="classdiv" data-toggle="tooltip" data-placement="left" title="11">11</div>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
But here the problem is that i cannot add manually data-toggle="tooltip" and title to every classdiv, becuase there are more than 500 div . so i need a solution in jquery , that cab add data-toggle="tooltip" to every classdiv, and convert value to title.
Also how i can change this text to any attribute and assign this value for example
<div class="classdiv">11</div> to <div class="classdiv" val="11" ></div>
Please help.
$(function(){ $('[data-toggle=tooltip]').tooltip(); });You need also to change your divs and insert adata-toggleandtitleattributes. - claudios