title: Jquery window.send_to_editor
body: <p>Couldn't come up with a good title for this.</p>
  
  <p>I've got a build in WordPress where I have multiple image uploads using the built in WordPress media uploader. How it's working is, after you upload and choose "insert", jQuery is inserting the image path into a text field, which contains the ID. Once you save, the text field is saved in the options table.</p>
  
  <p>Works perfectly if you only have 1 upload field. Once you add more uploads, every upload field gets saved with the same image path. Just need each upload button to only insert the value for it's associated text field.</p>
  
  <p>I've tried to use .each but couldn't get it working correctly. Also tried using .attr('id') to the value insert, but nothing doing there. </p>
  
  <p>Here is my jQuery and the markup: </p>
  
  <pre><code>jQuery('.upload-button').click(function() {
      formfield = jQuery('.upload').attr('name');
      tb_show('', 'media-upload.php?type=image&amp;amp;TB_iframe=true');
      return false;
  });
  
  window.send_to_editor = function(html) {
      imgurl = jQuery('img',html).attr('src');
      jQuery('.upload').val(imgurl);
      tb_remove();
  };
  
  &lt;div class="upload_field"
      &lt;input type="text" name="upload_one" id="upload_one" class="upload" value="" /&gt;
      &lt;input type="button" class="upload-button" value="Upload Image" /&gt;
  &lt;/div&gt;
  
  &lt;div class="upload_field"
      &lt;input type="text" name="upload_two" id="upload_two" class="upload" value="" /&gt;
      &lt;input type="button" class="upload-button" value="Upload Image" /&gt;
  &lt;/div&gt;
  
  &lt;div class="upload_field"
      &lt;input type="text" name="upload_three" id="upload_three" class="upload" value="" /&gt;
      &lt;input type="button" class="upload-button" value="Upload Image" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>For further info, here is the uploader setup I'm using:  <a href="http://www.webmaster-source.com/2010/01/08/using-the-wordpress-uploader-in-your-plugin-or-theme/">http://www.webmaster-source.com/2010/01/08/using-the-wordpress-uploader-in-your-plugin-or-theme/</a></p>
  
  <p>Any help, as always, is greatly appreciated.</p>