Hi friends i am trying to change the Data-caption of a in dynamic mode.
$("#btnchange").click(function(){
    var newanchor=  $(".fancybox a");
    newanchor.attr('caption', 'i am new caption');
});
When I clicked on the image to open it in third party plugin, tool called(fancybox), it's caption is not displaying.
But when I tried to add data caption by default it like:
<a id='a1' class="fancybox" data-caption='hey' 
 href="http://farm8.staticflickr.com/7171/6417719753_374653e28c_b.jpg">
    <img src="http://farm8.staticflickr.com/7171/6417719753_374653e28c_m.jpg" alt=""/>
</a>
Then it is showing perfectly. See my fiddle:
 
     
     
     
    