title: How JQuery handles with getElementsByClassName iteration?
body: <p>Today I was shortening my old codes and I saw this code:</p>
  
  <pre><code>$(".ceker").append("&lt;a href='kit/");
  $("#pdf").append("pdf");
  $("#txt").append("txt");
  $("#epub").append("epub");
  $(".ceker").append("/7.");
  $("#pdf").append("pdf");
  $("#txt").append("txt");
  $("#epub").append("epub");
  $(".ceker").append("'&gt;&lt;div class='menukitap'&gt;&lt;div class='menuharry7 menuharresler'&gt;&lt;/div&gt;&lt;h4&gt;Ölüm Yadigarları İndir&lt;/h4&gt;&lt;/div&gt;&lt;/a&gt;");
  </code></pre>
  
  <p>it used to output like that:</p>
  
  <pre><code>&lt;a href="kit/pdf/7.pdf"&gt;&lt;div class="menukitap"&gt;&lt;div class="menuharry7 menuharresler"&gt;&lt;/div&gt;&lt;h4&gt;Ã–lÃ¼m YadigarlarÄ± Ä°ndir&lt;/h4&gt;&lt;/div&gt;&lt;/a&gt;
  </code></pre>
  
  <p>And I made it shorter like this:</p>
  
  <pre><code>function item()
  {
      if( $('.ceker').attr('id') == 'pdf' )
      {
          return "pdf";
      }
      if( $('.ceker').attr('id') == 'txt' )
      {
          return "txt";
      }
      if( $('.ceker').attr('id') == 'epub' )
      {
          return "epub";
      }
  }
  
  $(".ceker").append("&lt;a href='kit/" + item() + "/7." + item() + "'&gt;&lt;div class='menukitap'&gt;&lt;div class='menuharry7 menuharresler'&gt;&lt;/div&gt;&lt;h4&gt;Ölüm Yadigarları İndir&lt;/h4&gt;&lt;/div&gt;&lt;/a&gt;");
  </code></pre>
  
  <p>This code works too, but I don't why it does. In my opinion, this code shouldn't work because the class "ceker" has already had 3 different IDs "pdf" 'txt' and "epub" </p>
  
  <p>So here's my question: How JQuery handles with <a href="https://stackoverflow.com/questions/5179798/javascript-getelementsbyclassname-always-returns-none?lq=1">getElementsByClassName Iteration</a> (answer 1)? (I do not understand how this works <code>if( $('.ceker').attr('id') == 'pdf' )</code>)</p>
  
  <p>And here is the HTML if you need to</p>
  
  <pre><code>&lt;nav class="menu"&gt;
                      &lt;span class="ara-menu-yer"&gt;Türkçe&lt;/span&gt;
                      &lt;a&gt;&lt;li&gt;&lt;section id="pdf" class="ceker"&gt;&lt;/section&gt;&lt;/li&gt;&lt;/a&gt;
                      &lt;a&gt;&lt;li&gt;&lt;section id="txt" class="ceker"&gt;&lt;/section&gt;&lt;/li&gt;&lt;/a&gt;
                      &lt;a&gt;&lt;li&gt;&lt;section id="epub" class="ceker"&gt;&lt;/section&gt;&lt;/li&gt;&lt;/a&gt;
                      &lt;span class="ara-menu-yer"&gt;English&lt;/span&gt;
                      &lt;a&gt;&lt;li&gt;&lt;section id="ingpdf" class="cekereng"&gt;&lt;/section&gt;&lt;/li&gt;&lt;/a&gt;
                      &lt;a&gt;&lt;li&gt;&lt;section id="ingdoc" class="cekereng"&gt;&lt;/section&gt;&lt;/li&gt;&lt;/a&gt;
                  &lt;/nav&gt;
  </code></pre>
  
  <hr>
  
  <p>I'm sorry for bad spelling, grammar or vocabulary mistakes if there is. And I think that I couldn't explain my issue but I wish you can understand.</p>