title: Get id value and set as link rel with jQuery
body: <p>I'm using <a href="http://projects.nickstakenburg.com/lightview/documentation/usage" rel="nofollow">Lightview</a> with WordPress, and trying to give WP galleries the necessary rels and classes. The default gallery markup is something like:</p>
  
  <pre><code>&lt;div id="gallery-1" class="gallery galleryid-1"&gt;
      &lt;dl class="gallery-item"&gt;
         &lt;dt class="gallery-icon"&gt;
         &lt;a href="image-link"&gt;&lt;img src="xxx" /&gt;&lt;/a&gt;
         &lt;/dt&gt;
      &lt;/dl&gt;
      &lt;dl class="gallery-item"&gt;
         &lt;dt class="gallery-icon"&gt;
         &lt;a href="image-link"&gt;&lt;img src="xxx" /&gt;&lt;/a&gt;
         &lt;/dt&gt;
     &lt;/dl&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Using jQuery i need to put a class on links (to trigger Lightview) and an attribute (to group them when viewing). I could get the simple part:</p>
  
  <pre><code>$(".gallery-icon a").attr('class','lightview');
  $(".gallery-icon a").attr('data-lightview-group','group');
  </code></pre>
  
  <p>It works. The class="lightview" activates, and the data-lightview-group attribute keeps all images in a single group "group" for best navigation. This way, the original code turns like this:</p>
  
  <pre><code>&lt;div id="gallery-1" class="gallery galleryid-1"&gt;
      &lt;dl class="gallery-item"&gt;
         &lt;dt class="gallery-icon"&gt;
         &lt;a href="image-link" class="lightview" data-lightview-group="group"&gt;&lt;img src="xxx" /&gt;&lt;/a&gt;
         &lt;/dt&gt;
      &lt;/dl&gt;
      &lt;dl class="gallery-item"&gt;
         &lt;dt class="gallery-icon"&gt;
         &lt;a href="image-link" class="lightview" data-lightview-group="group"&gt;&lt;img src="xxx" /&gt;&lt;/a&gt;
         &lt;/dt&gt;
      &lt;/dl&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>But if there is a long page with more than one gallery, they are merged, because all links will have the same "data-lightview-group".</p>
  
  <p>There is a way to get the id from each gallery and use them as value to this data-lightview-group attribute? Or any other approach to have a unique value in all links for each gallery?</p>