I have the following code :
<a id="plop" data-lightbox="image-1" data-title="aaa" href="https://unsplash.it/300/300">
<img src="https://unsplash.it/100/100" alt="" />
</a>
I want to change the "data-title" from "aaa" to "bbb" using something like this :
$('#plop').data('title','bbb');
But when I click on the link, the lightbox displays the old title :-/
How can I update the title with the new value ?
Thanks
Lightbox reads the attribute and not the jQuery data store.
To update the title, try the following: $('#plop').attr('data-title', 'bbb')
.