title: jQuery parent or parents to get data-attribute in table th tag
body: <p>I have a table that are like a grid with a horizontal list in the top with week numbers within <code>th</code> tags and below each week are different values in rows of <code>tr</code> and <code>td</code> tags. </p>
  
  <p>I'm trying to get the <code>data-attribute</code> for the <code>week</code> when I click below in one of the <code>td</code> tags with the <code>data-id attribute</code>. But I can't get it right and wonder what I have done wrong to be able to read this value?</p>
  
  <p>Some of the combinations I have tested:</p>
  
  <pre><code>var test = $(this).closest("th").attr("data-week");
  var test = $(this).parents().find(".week").attr("data-week");
  var test = $(this).parents("th").attr("data-week");
  </code></pre>
  
  <p>The HTML with data-attributes for the table:</p>
  
  <pre><code> &lt;table&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th class=""&gt;&lt;/th&gt;
                      &lt;th class="week" data-week="15"&gt;15&lt;/th&gt;
                      &lt;th class="week" data-week="16"&gt;16&lt;/th&gt;
                      &lt;th class="week" data-week="17"&gt;17&lt;/th&gt;
                      &lt;th class="week" data-week="18"&gt;18&lt;/th&gt;
                      &lt;th class="week" data-week="19"&gt;19&lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Stina (1)&lt;/td&gt;
                              &lt;td data-id="40"&gt;10&lt;/td&gt;
                              &lt;td data-id="12"&gt;20&lt;/td&gt;
                              &lt;td data-id="13"&gt;40&lt;/td&gt;
                              &lt;td data-id="14"&gt;45&lt;/td&gt;
                              &lt;td data-id="15"&gt;40&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Linda (2)&lt;/td&gt;
                              &lt;td data-id="0"&gt;0&lt;/td&gt;
                              &lt;td data-id="0"&gt;0&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Lasse (3)&lt;/td&gt;
                              &lt;td data-id="21"&gt;5&lt;/td&gt;
                              &lt;td data-id="22"&gt;39&lt;/td&gt;
                              &lt;td data-id="23"&gt;40&lt;/td&gt;
                              &lt;td data-id="24"&gt;40&lt;/td&gt;                       
                  &lt;/tr&gt;
          &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>