Upon clicking button, a bunch of data and links will be displayed, i want to open all the links into a new tabs using JavaScript

Viewed 43

I successfully added button, now upon clicking that button i want to open all links that are shown in results into a new tabs. I need a help with JavaScript I'm doing this code in Tampermonkey chrome extension.

(function () {
var bt = document.getElemntById("search_form");

var btn = document.createElement("button");

btn.innerHTML = "Open all links";
bt.appendChild(btn);
})();

I have the following page details

<div class="information editable">
  

    <ul class="all_numb_info">

    <li class="details_A numb_1">
            Details 1
        <span class="byline">
        </span> 
        <a target="_blank" rel="noopener noreferrer" href="http://google.com">Details 1</a> (1)
    </li>


    <li class="details_B numb_2">
            Details 2
        <span class="byline">
        </span>
        <a target="_blank" rel="noopener noreferrer" href="http://google.com">Details 2</a> (2)

    </li>

    <li class="details_C numb_3">
            Details 3
        <span class="byline">
        </span>
        <a target="_blank" rel="noopener noreferrer" href="http://google.com">Details 3</a> (3)

    </li>

    <li class="details_D numb_4">
            Details 4
        <span class="byline">
        </span>
        <a target="_blank" rel="noopener noreferrer" href="http://google.com">Details 4</a> (4)
    </li>
</ul>
0 Answers
Related