Jamie
asked on
Open grouped links on a page in new tabs via jquery
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.
e.g.
<script>
$('#ButtonOne').click(func tion() {
$('a').each(function() {
window.open($(this).attr(' href'));
});
});
</script>
<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
Jamie
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.
e.g.
<script>
$('#ButtonOne').click(func
$('a').each(function() {
window.open($(this).attr('
});
});
</script>
<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
Jamie
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Hi Mukesh,
Many thanks for your reply, but unfortunately, for some reason, I could not get it to work.
Regards
Jamie
Many thanks for your reply, but unfortunately, for some reason, I could not get it to work.
Regards
Jamie
ASKER
Hi Michael,
Many thanks for your reply and solution, it works perfectly :)
Very much appreciated.
Regards
Jamie
Many thanks for your reply and solution, it works perfectly :)
Very much appreciated.
Regards
Jamie
You are welcome :)
Open in new window