I am using $(el).tootltips(); and it is working fine but it doesn't effect on future objects. How can I initialized this effect for future objects too.
Asked
Active
Viewed 138 times
0
Cœur
- 34,719
- 24
- 185
- 251
Shakeel Ahmed
- 1,318
- 15
- 21
-
1You have to call the same function again after adding dynamic elements – Tushar Sep 16 '15 at 08:30
-
What plugin are you using? `jQueryUI`? `Bootstrap`? – D4V1D Sep 16 '15 at 08:34
-
@D4V1D I am using bootstrap. – Shakeel Ahmed Sep 16 '15 at 08:45
-
@D4V1D, thanks. that solution is working fine. – Shakeel Ahmed Sep 16 '15 at 08:48
1 Answers
0
You can do this in two ways:
- focus on the element and initialize it.
- wrap it in a function and call it when you add your future objects.
1.
$('body').on('focus', '.classNameOfFutureObj', function(){
$(this).tootltips();
});
2.
function makeTooltip($el){
$el.tootltips();
}
// you can call this function when you append your object in dom.
makeTooltip($('.classNameOfFutureObj'))
Jai
- 72,925
- 12
- 73
- 99