title: Set each data id and assign it to href
body: <p>I am running the following code as I am trying to get each <code>.fotorama</code> id first and then assign each of them as each <code>.nav</code> link href. </p>
  
  <pre><code>$(".fotorama").each(function(){
       id = $(".fotorama", this).data("id");
       $(".nav li a").attr("href",  '#'+  id);
  });
  </code></pre>
  
  <p>This is giving me <code>#undefined</code> to each <code>.nav</code> link tho</p>
  
  <p>How should I do to set same href as each <code>.fotorama</code> id?</p>
  
  <p>html, just an example, ids and menu items are dynamically generated on the site*</p>
  
  <pre><code>&lt;ul class="nav"&gt;
    &lt;li&gt;&lt;a href=" "&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=" "&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=" "&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  
  &lt;div class="fotorama" id="p1"&gt;&lt;/div&gt;
  &lt;div class="fotorama" id="p2"&gt;&lt;/div&gt;
  &lt;div class="fotorama" id="p2"&gt;&lt;/div&gt;
  </code></pre>