title: Select option not working for Modal
body: <p>Can someone help clarify here? I am trying to do the same thing as this <a href="https://stackoverflow.com/questions/36596594/set-select-option-selected-in-a-modal-bootstrap/42446394#42446394">post</a> but set the value dynamically. However when I do this, even though I'm setting the values before opening the modal, the value does not seem to be getting set.</p>
  
  <p>I have a Create New Campaign button as part of a table which when clicked, calls the javascript methods shown below:</p>
  
  <pre><code>&lt;th data-field="create_campaign"&gt;&lt;span class="create_campaign" text="{{product.id}}"&gt;&lt;a class="" href="#" data-target="campaign_modal" value="{{product.id}}"&gt;create new campaign&lt;/a&gt;&lt;/span&gt;&lt;br&gt;&lt;/th&gt;
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;div id="campaign_modal" class="modal"&gt;
      &lt;div class="modal-content"&gt;
          &lt;blockquote&gt;
              Product Campaign
          &lt;/blockquote&gt;
          &lt;div id="" class="row"&gt;
              &lt;div class="input-field col s5"&gt;
                  &lt;select id="product_selector" name="product_selector"&gt;
                      &lt;option disable value=" "&gt;Select a Product &lt;/option&gt;
                      {% for product in all_org_products %}
                          &lt;option value="{{product.id}}"&gt;{{product.name}}&lt;/option&gt;
                      {% endfor %}
                  &lt;/select&gt;
              &lt;/div&gt;
              &lt;div class="input-field col s5"&gt;
                  &lt;input type="text" id="campaign" class=""/&gt;
                  &lt;label for="campaign" id="label_campaign"&gt; Campaign &lt;/label&gt;
              &lt;/div&gt;
              &lt;div class="input-field col s2"&gt;
                  &lt;a class="btn-floating btn-small waves-effect waves-light teal" onclick="submitCampaign()"&gt;&lt;i class="material-icons"&gt;add&lt;/i&gt;&lt;/a&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class=" center"&gt;
              &lt;span class="done_btn"&gt;&lt;button id="done_btn" class="btn blue waves-effect waves-light modal-action"&gt;&lt;i class="material-icons left" &gt;done&lt;/i&gt;Done&lt;/button&gt;&lt;/span&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Javascript</p>
  
  <pre><code>    $('.create_campaign').click(function () {
          product_id = $(this).attr('text');
          var product_select = document.getElementById('product_selector');
          console.log(product_select);
          var index=0;
          for (var i=0; i&lt;product_select.options.length; i++){
              if (product_select.options[i].value == product_id){
                  index=i;
                  product_select.value=product_id
                  break;
              }
          }
          product_select.selectedIndex = index;
          openCampaignModal();
      });
  
      function openCampaignModal(){
          $('#campaign_modal').openModal();
      };
  </code></pre>