title: Finding the id of a parent div using Jquery
body: <p>I have some html like this:</p>
  
  <pre><code>&lt;div id="1"&gt;
      &lt;p&gt;
          Volume = &lt;input type="text" /&gt;
          &lt;button rel="3.93e-6" class="1" type="button"&gt;Check answer&lt;/button&gt;
      &lt;/p&gt;
      &lt;div&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and some JS like this:</p>
  
  <pre><code>$("button").click(function () {
      var buttonNo = $(this).attr('class');
      var correct = Number($(this).attr('rel'));
  
      validate (Number($("#"+buttonNo+" input").val()),correct);
      $("#"+buttonNo+" div").html(feedback);
  });
  </code></pre>
  
  <p>What I'd really like is if I didn't have to have the class="1" on the button (I know numeric classes aren't valid, but this is a WIP!), so I could determine buttonNo based on the id of the parent div. In real life there are multiple sections looking like this.</p>
  
  <ol>
  <li><p>How do I find the id of the div parenting the button.</p></li>
  <li><p>What would be a more semantic way to store the answer in the button code. I want to make this as foolproof as possible for a non programmer to copy and paste without breaking things!</p></li>
  </ol>