title: How can I automatically open all the links on a page with jQuery?
body: <p>I have a page with 10 links and want to open all of them once I click on a button.   </p>
  
  <p>I use the following code, which is not working for me.</p>
  
  <pre><code>&lt;a id="some-id" href="SOShousin3.jpg"&gt;Click Here&lt;/a&gt;&lt;br /&gt;
  &lt;a id="some-id" href="SOShousin3.jpg"&gt;Click Here&lt;/a&gt;&lt;br /&gt;
  &lt;a id="some-id" href="SOShousin3.jpg"&gt;Click Here&lt;/a&gt;&lt;br /&gt;
  &lt;a id="some-id" href="SOShousin3.jpg"&gt;Click Here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
  
  &lt;script type="text/javascript"&gt;
      $('a').click(function() {
          // assign an event to a.onclick
          window.open($(this).attr('href') );
      });
  
      $('ButtonOne').click(function() {
          // when we press &lt;button&gt;, trigger a.onclick
          $('a').click();
      });
  &lt;/script&gt;
  
  &lt;button type="button" onclick="ButtonOne"&gt;Open Links&lt;/button&gt;
  </code></pre>