Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 452833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:06:43+00:00 2026-05-12T22:06:43+00:00

I have a requirement to click on multiple links (selecting them) and then click

  • 0

I have a requirement to click on multiple links (selecting them) and then click a button that will open all selected links in new windows or tabs. This will of course be dependent upon the browser behaviour.

My plan is to use Javascript to add the selected links to an array and then upon clicking the submit button, the javascript will run through the array and open a new window for each item. I will probably do this in jQuery.

Has anyone done anything similar? Are there alternatives?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T22:06:44+00:00Added an answer on May 12, 2026 at 10:06 pm

    I think you are right.

    The best way to achieve what you are describing IMHO is to place URL’s of links you want to open in new windows into an array, using return false; in order to prevent actually opening link and then to use some sort of loop to open all of them.

    I took a liberty of putting together few lines of jQuery code that will do what you have described:

    $(document).ready(function() {
        var $hash = new Array(); // We create new Array 
        $('a').click( function(){ // On each click to <a> element
            if ( $(this).attr("data-pack") == "true" ) { // check wether this is one of the links we use
                $hash[$(this).attr("id")] = $(this).attr("href"); // We add href value into $hash object
                $(this).css("color","green"); // Way to mark selected ones
                $(this).attr("data-pack", "selected"); // Change data-pack property value to selected
                return false; // We don't want to execute this yet
            } else if ( $(this).attr("data-pack") == "selected" ) { // In case you change your mind and want to unselect
                $(this).attr("data-pack", "true"); // Change data-pack property back, thanks to Ambrosia pointing it out in the comment
                $(this).css("color","red"); // We mark it as unset
                delete $hash[$(this).attr("id")]; // Remove it from hash
                return false;
            }
        });
    
        $("form").submit( function(){ // After we submit
            for (var i in $hash) { // Go trough $hash
                window.open($hash[i]); // And open window for each member
            }
            return false; // We don't actually want to submit form, just open new windows :)
        } );    
    });
    

    HTML would look something like:

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Page Title</title>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript" charset="utf-8" async defer></script>
        <script src="application.js" type="text/javascript" charset="utf-8" async defer></script>
    </head>
    <body>
        <a href="#link1" data-pack="true" id="link1">data</a>
        <a href="#link2" data-pack="true" id="link2">data</a>
        <a href="#link3" data-pack="true" id="link3">data</a>
        <a href="#link4" data-pack="true" id="link4">data</a>
        <a href="#">ordinary link</a>
    
        <form>          
            <input type="submit" value="submit">
        </form>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple requirement: One browse button opens multiple file choosers. When file
I Have a WPF window that have a RadGridView and a Button, My requirement
I have a requirement in WPF/C# to click on a button, gather some data
In my ASP.Net application I have a requirement that when a user clicks on
We have a requirement in project to store all the revisions(Change History) for the
We have the requirement to take a form submission and save some data, then
I have a requirement in my application that I think can be met by
I have a requirement on my current project (a Flex app which will be
I have a form with upload field i click the browse button and choose
I have a new web app that is packaged as a WAR as part

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.