title: How to get the ID of a dynamic element when clicked?
body: <p>I have a simple html file upload form, it's something like this:</p>
  
  <pre><code>&lt;form action="upload_file.php" id="theForm" method="post" onsubmit="return validateForm()" enctype="multipart/form-data"&gt;
  &lt;label for="file"&gt;Files:&lt;/label&gt;
  &lt;input type="file" name="file[]" id="file1"&gt;&lt;button id="rem1" type="button"&gt;Remove File&lt;/button&gt;
  ...
  ...    
  &lt;input type="file" name="file[]" id="file99"&gt;&lt;button id="rem99" type="button"&gt;Remove     File&lt;/button&gt;
  &lt;input type="submit" name="submit" value="Submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The inputs are created dynamically. I need to know the id of the button which was clicked.</p>