title: How to change data-target of a button within a modal using Javascript?
body: <p>I have a button within a modal. When I press the button, I want that modal to close, and another modal to open. However, the modal that opens isn't the same each time, so the data-target on the button needs to change each time it is pressed.</p>
  
  <p>In order to close the modal, I have <code>data-dismiss="modal"</code> in the attributes of the button.</p>
  
  <p>I have three modals with ID's <code>1,2,3</code>. I want to use the random Javascript function to choose which one opens</p>
  
  <pre><code>var randomnumber = num.toString(Math.floor(Math.random() * (3 - 1 + 1)) + 1);
  </code></pre>
  
  <p>I tried doing this, but it didn't work:</p>
  
  <pre><code>$('#button').click(function() {
  $(randomnumber).modal('show');
  </code></pre>