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