troubleshooting Question

Open grouped links on a page in new tabs via jquery

Avatar of Jamie
JamieFlag for United Kingdom of Great Britain and Northern Ireland asked on
5 Comments1 Solution192 ViewsLast Modified:
Hello Experts,

If I have a number of grouped links on a page - how can I automatically open then into new tabs by a press of a button.


$('#ButtonOne').click(function() {
    $('a').each(function() {$(this).attr('href'));

<a id="group1" href="page1.html">Click Here</a><br />
<a id="group1" href="page2.html">Click Here</a><br />
<a id="group1" href="page3.html">Click Here</a><br />
<a id="group2" href="page4.html">Click Here</a><br />

<button type="button" id="group1">Open Links</button> - should only open page1.html, page2.html, page3.html
<button type="button" id="group2">Open Links</button> - should only open page4.html

Many thanks

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros