Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

the tooltip in bootstrap doesn't work after ajax

I have a file named index.php, which in I include another file named file1.php (in index.php I include all necessary files for jQuery, js etc.). In file1.php I have a table with buttons which each opens a modal. the information in the modal is from an ajax call for file2.php. in file2.php I create a table. In the table I have the cell :

<button class='btn btn-default tooltip-default' data-toggle='tooltip' data-trigger='hover' data-placement='top' data-content='content' data-original-title='Twitter Bootstrap Popover'>AAA</button>

and, well, the tooltip doesn't work. but, when I copy this and get it to file1.php, bellow the table, the tooltip does work.

Can anyone help me fix the tooltip ? Thx.

like image 360
Yuvalb Avatar asked Sep 07 '15 16:09

Yuvalb


1 Answers

Use selector on exist element like body

$('body').tooltip({selector: '[data-toggle="tooltip"]'});
like image 184
elyas.m Avatar answered Oct 08 '22 20:10

elyas.m