title: how to get id of next element jquery?
body: <p>here the html code, and i want to get the id of next element from clicked element a with class coba or to get id of  element table class coba2.</p>
  
  <pre><code>&lt;div class="dropdown"&gt;
    &lt;label&gt;Kategori&lt;/label&gt;
    &lt;button class="btn btn-default dropdown-toggle" type="button" id="jenis_kues" data-toggle="dropdown"&gt;Tambah Pertanyaan
      &lt;span class="caret"&gt;&lt;/span&gt;
    &lt;/button&gt;
    &lt;ul class="dropdown-menu" role="menu" aria-labelledby="jenis_kues"&gt;
      &lt;li role="presentation"&gt;
        &lt;a class="coba" id="teks" role="menuitem" tabindex="-1" href="#" onclick="tambah_kues_teks()"&gt;Teks&lt;/a&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  &lt;table class="coba2" id="kues_teks-'+i+'"&gt;
  &lt;/table&gt;&lt;/div&gt;
  </code></pre>
  
  <p>and i've tried using this script </p>
  
  <pre><code>var a = $('.coba').next('.coba2'); alert(a.attr('id'));
  </code></pre>
  
  <p>but it show me undefined, anyone know how?</p>