I'm building a custom start page for myself and one issue I'm running into is I want to have a link above all sections that, when clicked, will open all pages in a new tab. I've got it parsing through the list, but only the first link opens in a new tab, all the others open in new windows.
Here's a link to the page I'm working on:
https://dl.dropboxusercontent.com/u/114859/code-experiments/start-tab.html
Here's an HTML snippet of an example section:
<section>
<h2>Wallpaper Sites (<a href="#">open all</a>)</h2>
<ul>
<li><a href="http://wall.alphacoders.com/">Alpha Coders</a></li>
<li><a href="http://interfacelift.com/">InterfaceLIFT</a></li>
<li><a href="http://thepaperwall.com/">The Paper Wall</a></li>
<ul>
</section>
Here's the JavaScript (mostly jQuery):
$( 'h2 a' ).on( 'click', function ( event ) {
event.preventDefault();
event.stopPropagation();
$( this ).parent().next().find( 'a' ).each( function () {
// console.log( this.href );
window.open( this.href );
window.focus();
});
});