title: How do I create a unique ID in javascript each time a function is called?
body: <p>Here's the function:</p>
  
  <pre><code>function addAttachment() {
      if (allowed_attachments &lt;= 0)
           return alert("', $txt['more_attachments_error'], '");
  
      document.getElementById("uploadBtn").onchange = function () {                                                
           document.getElementById("uploadFile").value = this.value;
      };
  
  
      setOuterHTML(document.getElementById("moreAttachments"), 
          \'&lt;div class="upload_attachment"&gt;\
              &lt;input id="uploadFile" placeholder="File"&gt;\
              &lt;label class="custom-file-input"&gt;\
                  &lt;input type="file" id="uploadBtn" name="attachment[]"&gt;\
              &lt;/label&gt;&lt;/div&gt;&lt;span id="moreAttachments"&gt;\
          &lt;/span&gt;\');
      allowed_attachments = allowed_attachments - 1;
      return true;
  }
  </code></pre>
  
  <p>UploadBtn and UploadFile need to be unique everytime, how do I do this? I'm really stuck</p>