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 192529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:26:00+00:00 2026-05-11T16:26:00+00:00

I have a problem with faking an anchor click via jQuery: Why does my

  • 0

I have a problem with faking an anchor click via jQuery:
Why does my thickbox appear the first time I click on the input button, but not the second or third time?

Here is my code:

<input onclick="$('#thickboxId').click();" type="button" value="Click me" />

<a id="thickboxId" href="myScript.php" class="thickbox" title="">Link</a>

It does always work when I click directly on the link, but not if I try to activate the thickbox via the input button. This is in FF. For Chrome it seems to work every time. Any hints?

  • 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-11T16:26:00+00:00Added an answer on May 11, 2026 at 4:26 pm

    Try to avoid inlining your jQuery calls like that. Put a script tag at the top of the page to bind to the click event:

    <script type="text/javascript">
    $(function(){
        $('#thickboxButton').click(function(){
            $('#thickboxId').click();
        });
    });
    </script>
    
    <input id="thickboxButton" type="button" value="Click me">
    <a id="thickboxId" href="myScript.php" class="thickbox" title="">Link</a>
    

    Edit:

    If you’re trying to simulate a user physically clicking the link, then I don’t believe that is possible. A workaround would be to update the button’s click event to change the window.location in Javascript:

    <script type="text/javascript">
    $(function(){
        $('#thickboxButton').click(function(){
            window.location = $('#thickboxId').attr('href');
        });
    });
    </script>
    

    Edit 2:

    Now that I realize that Thickbox is a custom jQuery UI widget, I found the instructions here:

    Instructions:

    • Create a link element (<a href>)

    • Give the link a class attribute with a value of thickbox (class="thickbox")

    • In the href attribute of the link add the following anchor: #TB_inline

    • In the href attribute after the #TB_inline add the following query string on to the anchor:

      ?height=300&width=300&inlineId=myOnPageContent

    • Change the values of height, width, and inlineId in the query accordingly (inlineID is the ID value of the element that contains the content you would like to show in a ThickBox.

    • Optionally you may add modal=true to the query string (e.g. #TB_inline?height=155&width=300&inlineId=hiddenModalContent&modal=true) so that closing a ThickBox will require calling the tb_remove() function from within the ThickBox. See the hidden modal content example, where you must click yes or no to close the ThickBox.

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

Sidebar

Ask A Question

Stats

  • Questions 158k
  • Answers 158k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Right click solution->Configuration Manager->Disable "Build" on your setup project May 12, 2026 at 11:18 am
  • Editorial Team
    Editorial Team added an answer I would definitely read the article to which Richard points.… May 12, 2026 at 11:18 am
  • Editorial Team
    Editorial Team added an answer You can call something like [parser performSelectorInBackground:@selector(parseXML) withObject:nil]; on your… May 12, 2026 at 11:18 am

Related Questions

as my last question was answered inmediatly.. i decided to post a new one
I am running two different sites on two different servers with two different domains.
I am facing a problem with one of my XBAP (WPF Browser application) projects:
I have a web application based on the sharp-architecture framework. It actually use NHibernate

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.