title: HTML and javascript show multiple div's
body: <p>I have a code wich will show/hide respective div's if a value from a dropdown list is selected. The values from the hidden div's will be added to a db.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;script&gt;
  document.getElementById('number').addEventListener('change', function ()
  {
      var style = number.value == 1 ? 'block' : 'none';
      document.getElementById('1tower').style.display = style;
   var style = number.value == 2 ? 'block' : 'none';
      document.getElementById('2tower').style.display = style;
   var style = number.value == 3 ? 'block' : 'none';
   document.getElementById('3tower').style.display = style;
  });
  &lt;/script&gt;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;select id="number" name="number_towers"&gt;
  &lt;option hidden value=""&gt;&lt;/option&gt;
  &lt;option value="1"&gt;1 tower&lt;/option&gt;
  &lt;option value="2"&gt;2 towers&lt;/option&gt;
  &lt;option value="3"&gt;3 towers&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;div id="1tower" style="display: none;"&gt;
  A Tower Value 1: &lt;input type ="text" name = "curent_nominal_sec1"/&gt;&lt;br&gt;
  B Tower Value 1: &lt;input type ="text" name = "putere_sec1"/&gt;&lt;br&gt;
  C Tower Value 1: &lt;input type ="text" name = "clasa_precizie_sec1"/&gt;&lt;/div&gt;
  
  &lt;div id="2tower" style="display: none;"&gt;
  A Tower Value 2: &lt;input type ="text" name = "curent_nominal_sec2"/&gt;&lt;br&gt;
  B Tower Value 2: &lt;input type ="text" name = "putere_sec2"/&gt;&lt;br&gt;
  C Tower Value 2: &lt;input type ="text" name = "clasa_precizie_sec2"/&gt;&lt;/div&gt;
  
  &lt;div id="3tower" style="display: none;"&gt;
  A Tower Value 3: &lt;input type ="text" name = "curent_nominal_sec3"/&gt;&lt;br&gt;
  B Tower Value 3: &lt;input type ="text" name = "putere_sec3"/&gt;&lt;br&gt;
  C Tower Value 3: &lt;input type ="text" name = "clasa_precizie_sec3"/&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Is there a way to display div's combinated ?
  Example: If I select 2 towers, then display div 1 and 2.
  If I select 3 towers, then display div 1,2 and 3.</p>
  
  <p>Any help will be apreciated</p>