Javascript loading issue or order of operations issue
<p>I have a link that Generates content. This is all working. I'm trying to associate a JS with this content, which is not working:</p>

<pre><code>function add_fields(link, association, content) {
  var new_id = new Date().getTime();
  var regexp = new RegExp("new_" + association, "g")
  console.log(content);
  $(link).parent().after(content.replace(regexp, new_id));

  console.log(new_id);
  console.log("promotion_profile_extrafields_attributes_" + new_id + "_image")
  RD.FileUpload.create({
    fileFieldName: "file",
    inputNodeID: "promotion_profile_extrafields_attributes_" + new_id + "_image",
    progressBarID: "bgUploaderProgressbar",
    swfuploadOptions: $.extend({
      post_params: {
        dir: "chag/assets"
      },
      button_placeholder_id: "bgUploaderButton3"
    }, Settings.swfOptionsforImages)
  });
}
</code></pre>

<p>This is generating the correct selector: promotion_profile_extrafields_attributes_1316033511105_image, which is a time stamped to make the id unique. I'm not sure why my JS isn't working.</p>
