title: JS functions to add days to the HTML select box
body: <p>I am trying to append my select box, so it shows days from 1 to 31 but when i reload the page it appears like a selectbox and the days are looped 3 times.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function selectDays()
  {
      var min = 1,
                max = 31,
                select = document.getElementById('selectDay1');
  
                for (var i = min; i&lt;=max; i++){
                var opt = document.createElement('option');
                opt.value = i;
                opt.innerHTML = i;
                select.appendChild(opt);
                }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>              &lt;div class="col-sm-4" id="day"&gt;
                &lt;select class="form-control" id="selectDay1" onclick="selectDays()"&gt;
                  &lt;option selected&gt;Day&lt;/option&gt;
                &lt;/select&gt;
              &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>