title: Cannot set attribute of hidden or display none form input
body: <p>I have a table of link buttons and on click I open a Bootstrap modal. I am able to pass data to the modal based on the row clicked using .html() for a specific element class or id but I cannot set the value or data-id attribute of a hidden input field or button. I am however able to set the value of a regular text input (not hidden).</p>
  
  <p><strong>Script</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          $('#ratepop').on('show.bs.modal', function(e) {
              var $modal = $(this),
              aid   = e.relatedTarget.id;
              title = '&lt;strong&gt;Rate:&lt;/strong&gt; ' + e.relatedTarget.title;
              newsrc = e.relatedTarget.name;
  
              //$('#aid').attr('data-id', '222');
              $('#aid').val('222');
              $('#ratepop_label').html(title);
              $('#news_src').html(newsrc);
          });
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>Modal</strong></p>
  
  <pre><code>&lt;div class="modal fade" id="ratepop" tabindex="-1" role="dialog" aria-labelledby="ratepop_label" aria-hidden="true"&gt;
  &lt;div class="modal-dialog" role="document"&gt;
  &lt;form role="form" id="arate_form" method="POST"&gt;
  &lt;div class="modal-content"&gt;
    &lt;div class="modal-header bkgcol-baby-blue"&gt;
      &lt;h4 class="modal-title light-black" id="ratepop_label"&gt;&lt;/h4&gt;
      &lt;br /&gt;
      &lt;div&gt;&lt;span id="news_src" class="label label-info article_source"&gt;&lt;/span&gt;&lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="modal-body margin_left"&gt;
      &lt;div class="form-group"&gt;
          &lt;div class="radio"&gt;
              &lt;label class="radio-inline"&gt;
                &lt;input name="radioGroup" value="1" checked="" type="radio"&gt;Radio 1
              &lt;/label&gt;
          &lt;/div&gt;
              &lt;div class="radio"&gt;
              &lt;label class="radio-inline"&gt;
                &lt;input name="radioGroup" value="2" type="radio"&gt;Radio 2
              &lt;/label&gt;
          &lt;/div&gt;
              &lt;div class="radio"&gt;
              &lt;label class="radio-inline"&gt;
                &lt;input name="radioGroup" value="3" type="radio"&gt;Radio 3
              &lt;/label&gt;
          &lt;/div&gt;
  
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="modal-footer"&gt;
      &lt;button type="button" class="btn btn-info" data-dismiss="modal"&gt;Close&lt;/button&gt;
      &lt;button type="submit" id="rate_button" class="btn btn-info"&gt;Rate&lt;/button&gt;
      &lt;input type="text" style="display:none;" name="aid" id="aid" data-id="" value=""&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p><a href="https://i.stack.imgur.com/1KP5S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1KP5S.png" alt="enter image description here"></a></p>