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).

**Script**

```
<script type="text/javascript">
        $('#ratepop').on('show.bs.modal', function(e) {
            var $modal = $(this),
            aid   = e.relatedTarget.id;
            title = '<strong>Rate:</strong> ' + e.relatedTarget.title;
            newsrc = e.relatedTarget.name;

            //$('#aid').attr('data-id', '222');
            $('#aid').val('222');
            $('#ratepop_label').html(title);
            $('#news_src').html(newsrc);
        });
</script>

```

**Modal**

```
<div class="modal fade" id="ratepop" tabindex="-1" role="dialog" aria-labelledby="ratepop_label" aria-hidden="true">
<div class="modal-dialog" role="document">
<form role="form" id="arate_form" method="POST">
<div class="modal-content">
  <div class="modal-header bkgcol-baby-blue">
    <h4 class="modal-title light-black" id="ratepop_label"></h4>
    <br />
    <div><span id="news_src" class="label label-info article_source"></span></div>
  </div>
  <div class="modal-body margin_left">
    <div class="form-group">
        <div class="radio">
            <label class="radio-inline">
              <input name="radioGroup" value="1" checked="" type="radio">Radio 1
            </label>
        </div>
            <div class="radio">
            <label class="radio-inline">
              <input name="radioGroup" value="2" type="radio">Radio 2
            </label>
        </div>
            <div class="radio">
            <label class="radio-inline">
              <input name="radioGroup" value="3" type="radio">Radio 3
            </label>
        </div>

    </div>
  </div>
  <div class="modal-footer">
    <button type="button" class="btn btn-info" data-dismiss="modal">Close</button>
    <button type="submit" id="rate_button" class="btn btn-info">Rate</button>
    <input type="text" style="display:none;" name="aid" id="aid" data-id="" value="">
  </div>
</div>
</form>

```

[![enter image description here](https://i.stack.imgur.com/1KP5S.png)](https://i.stack.imgur.com/1KP5S.png)