title: jquery ID of previous dynamically added text area
body: <p>I'm attempting to hack a wordpress plugin to gain some extra functionality.</p>
  
  <p>As it stands i've adjusted it so I can add a new textarea with it's own upload box.</p>
  
  <p>I now need a way to get the ID of the new textarea, so I can pass the uploaded file text back to the correct textarea.</p>
  
  <p>this is my code:</p>
  
  <p><strong>JQUERY:</strong></p>
  
  <pre><code>&lt;script type="text/jquery"&gt;
  jQuery(document).ready(function() {
  
  jQuery('#upload_image_button').live("click", function() {
   var tblID = jQuery(this).closest("textarea").attr("id");
   alert(tblID); // returns undefined.
  
  
   formfield = jQuery('#upload_image').attr('name');
   tb_show('','media-upload.php?type=image&amp;TB_iframe=true');
   return false;
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>as it stands, this doesn't work. I get "undefined", rather than the ID of the text area as I hoped.</p>
  
  <p>the markup for each DIV that gets added is like this, where * indicates a unique number:</p>
  
  <pre><code>&lt;div id="my*Div&gt;
  &lt;textarea class="dfrads_textarea" id="dfrads_textarea_*" name="ad_*"&gt;
    &lt;!-- my content --&gt;
  &lt;/textarea&gt;
  Upload:
  &lt;label for="upload_image"&gt;&lt;input type="text" value="" name="upload_image_*" size="36" id="upload_image_*"&gt;&lt;input type="button" value="Upload Image" id="upload_image_button_*"&gt;&lt;br&gt;Enter an URL or upload an image for the banner.&lt;/label&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>so if I add 2 extra DIVs, the * would be "2" in this example. (The second DIV).</p>
  
  <p>How can I get the value of the ID of the textarea that is "paired" with the submit button.</p>
  
  <p>thanks ! I have tried .prev and .closest, but presumably am using it wrongly.</p>