Is there any way to automatically enable tippy for elements which are added dynamically (via ajax) in page?
For example, if i activate tippy:
<script>
tippy('.btn')
</script>
then it's all ok. But if new elements with the same class .btn are added to the page dynamically, they won't have the tippy.
A lot of stuff is loaded via ajax, so manually activating the tippy after each ajax request will be a bad practice (time consuming, forget somewhere to call it, etc.)
This is nice use case for event delegation.
Apply the tippy to the parent container of your .btn elements, and use target
tippy(parent, { target: '.btn' })
Damn and I've RTFM, but skipped the delegation part :/
Thanks!
@atomiks
Still working? I can not see target param in docs.
Use tippy.delegate() instead now, but otherwise the same.
Most helpful comment
This is nice use case for event delegation.
Apply the tippy to the parent container of your
.btnelements, and usetarget