Gomzy Gomzy - 1 year ago 58
jQuery Question

how to trigger all anchor tags on click of a button?

sorry if title is wrong

i want to open all the links on a single click

thank you in advance


<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

<a href="1.link">test</a>
<br />
<a href="2.link">test2</a>
<input type="button" id="bb" value="click">


Answer Source

Try like following.

$("#bb").click(function () {
    $('a').each(function() {
        window.open($(this).attr('href'), '_blank');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download