title: Open two new tabs from popup.html and popup.js
body: <p>I have some code, which lets user check checkboxes and on submit opens urls associted with checkboxes in new tabs. In case both checkboxes are checked two tabs become opened. It works like expected and looks like:</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>document.getElementById('cbx').addEventListener(
  
      'submit', function checkForm(event) {
   
      //Prevents default action that would normally happen onsubmit
     event.preventDefault();
      
      //Define the form element
      var form = document.getElementById("cbx");
  
      if (form.cb1.checked) {
          window.open('http://google.com/', '_blank');
      }
      if (form.cb2.checked) {
          window.open('http://yahoo.com/', '_blank');
      }
  
      return true;
  
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form id="cbx"&gt;
   
   &lt;label for="cb1"&gt;G&lt;/label&gt;
   &lt;input name="cb1" type="checkbox"&gt;
   
   &lt;label for="cb2"&gt;Y&lt;/label&gt;
   &lt;input name="cb2" type="checkbox"&gt;
   
   &lt;input type="submit" value="Submit"&gt;
   
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Now i want to include this functionality in my Chrome extension:</p>
  
  <ul>
  <li>the HTML part is in popup.html,</li>
  <li>Javascript part is in the popup.js.</li>
  </ul>
  
  <p>The problem is: if both checkboxes are checked only one te first <code>cb1</code> tab with url is opened.</p>
  
  <p>Why is it so? How can i achieve that if all checkboxes are checked, tabs with all according urls become opened?</p>