title: jQuery, javascript: several forms same submit button text - how to determine value of closest hidden value box
body: <p>I have several forms in HTML, each with a submit button and a hidden field.  The same javascript function is called when any of the submit buttons are pushed.  I want to know which submit button has been pushed.  I think I can do this by finding out what the hidden field value is of the corresponding form - but I'm having difficulty with this.  My HTML is:</p>
  
  <pre><code>&lt;div id="existingPhotosList"&gt;
  &lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;
      &lt;img src="./userPictures/IMG0001.jpg"&gt;
  &lt;/td&gt;
  &lt;td&gt;
      &lt;form class="deleteFiles"&gt;
          &lt;input type="hidden" name="picture" value="IMG0001.jpg"&gt;
          &lt;input type="submit" name="deleteFile" value="Delete File"&gt;
      &lt;/form&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;
      &lt;img src="./userPictures/IMG0002.jpg"&gt;
  &lt;/td&gt;
  &lt;td&gt;
      &lt;form class="deleteFiles"&gt;
          &lt;input type="hidden" name="picture" value="IMG0002.jpg"&gt;
          &lt;input type="submit" name="deleteFile" value="Delete File"&gt;
      &lt;/form&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>There may be more or less table rows with images and forms on them - depending on how many images are found on the server.  </p>
  
  <p>The javascript I have right now is:</p>
  
  <pre><code>$('.deleteFiles').submit(deleteFile);
  
  function deleteFile()  {
  
      var myValue = $(this).parent().closest(".picture").val();
      alert(myValue);
  
      return false;
  
  } 
  </code></pre>
  
  <p>I'm currently getting undefined as the result of the alert.</p>