title: How do you pull id data with a JQuery button click?
body: <p>I can pull data from a modal  <code>$('#ID').on('shown.bs.modal', function (e) { var somevariable = e.id; });</code> doing this method, but can't figure out how to do it with a button click.  </p>
  
  <p>If that is possible, how can I also inherit the data if this button click opens the modal?</p>
  
  <p><a href="http://www.bootply.com/jCXXE6chXu" rel="nofollow">http://www.bootply.com/jCXXE6chXu</a></p>
  
  <pre><code>$(document).ready(function(){
    $(".file_to_upload").click(function (data) {
    //alert("works");
        var questionID = data.id;
      alert(questionID);
      $('[id*="uploaded_files_"]').modal('show');
      $('[id*="uploaded_files_"]').on('shown.bs.modal', function (e) {
      $("#auditinstanceupload").html("&lt;input id='audit_instance_id' name='audit_instance_id' value='"+questionID+"' type='hidden' style='display:none;'&gt;");
      $("#auditidupload").html("&lt;input id='audit_id' name='audit_id' value='"+questionID+"' type='hidden' style='display:none;'&gt;");
      });
    });
  });
  
  &lt;!-- 5 is a php row id for an example --&gt;
  
   &lt;a title="Upload file" href="#" id="5"
  class="btn btn-default file_to_upload" &gt;upload button&lt;/a&gt;
  
  
  &lt;!-- modal pop up for [F] button --&gt;
  &lt;div class='modal fade' style='z-index:10000' id='uploaded_files_5' role='dialog'&gt;
    &lt;div class='modal-dialog modal-lg'&gt;
      &lt;div class='modal-content'&gt;
      &lt;div class='modal-header'&gt;
      &lt;button type='button' class='close' data-dismiss='modal' aria-hidden='true'&gt;&lt;/button&gt;
      &lt;h4 class='modal-title'&gt;Perform Audit&lt;/h4&gt;
    &lt;/div&gt;
    &lt;div class='modal-body' id='perform_audit1'&gt;
      &lt;form id='my_form' name='form' action='ajax/file_upload.php' method='POST' enctype='multipart/form-data' style=''&gt;
        &lt;h1&gt;Upload File&lt;/h1&gt;
        &lt;div id='main'&gt;
          &lt;strong&gt;File: &lt;/strong&gt;&lt;input name='myFile' id='myFile' size='27' type='file'&gt;
          &lt;input id='my_button' name='action' value='Upload' onclick='uploadshow()' type='button'&gt;
          &lt;input id='auditinstanceupload' style='display:none;' /&gt;
          &lt;input id='auditidupload' style='display:none;' /&gt;
          &lt;input id='question_id' name='question_id' value='$row[questionID]' type='hidden'&gt;
        &lt;/div&gt;
        &lt;!--&lt;input id='close_file_upload' value='Close' type='button'&gt;--&gt;
      &lt;/form&gt;
    &lt;/div&gt;
    &lt;div class='modal-footer'&gt;
      &lt;form method = 'POST'&gt;
        &lt;input type='button' id='yes_delete' value='Yes ' name='view_audits_delete' /&gt;
        &lt;button type='button' class='btn btn-default' data-dismiss='modal'&gt;No&lt;/button&gt;
         &lt;/form&gt;  
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;!-- modal pop up for [F] file upload button --&gt;            
  </code></pre>