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

  • SEARCH
  • Home
  • 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 6388063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:13:55+00:00 2026-05-25T03:13:55+00:00

Ok, so I searched all over with no answer. Can someone explain why does

  • 0

Ok, so I searched all over with no answer.
Can someone explain why

does not work with .trigger('click')

<a id="openNew" href="http://www.example.org">Click me</a>

<script type='text/javascript'> 
    $(window).load(function(){
        $('#openNew').addClass("external").attr({ target: "_blank", href: 'http://www.google.com' }).trigger('click');
    });
</script>

and it does not work with .click()

<script type='text/javascript'> 
    $(window).load(function(){
        $('#openNew').addClass("external").attr({ target: "_blank", href: 'http://www.google.com' }).click();
    });
</script>

Does not click the link whatever I do. It only works if I click it. How can I make it auto click?
Working on this for about 1 hour and is driving me crazy, I know I’m must be doing something stupid.

JsFiddle for your convenience.

I wouldn’t mind any other solution in plain JavaScript.

  • 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-25T03:13:56+00:00Added an answer on May 25, 2026 at 3:13 am

    Simulating a user physically clicking the link is not possible. Since you are using target=’_blank’ I presume you want a new window? So you’ll need to use window.open. Which popup blockers wont like.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've searched all over the internet, but I can't find an answer to my
Ok I have searched all over and I can't not seem to find the
I've searched all over the place and can't seem to find an answer for
I've searched all over the web and can't seem to find documentation or even
I have searched the forums and all over the web and have not really
I've searched all over for an answer to this simple question, with no luck.
.NET/MVC3 newbie, so please bear with me! I've searched for this answer all over
I've searched all over and havent quite found the answer for my particular question.
I've searched all over and I can't figure this one out. I am working
I've searched for an answer for this all over but the solutions offered did

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.