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

Related Questions

Im facing following problem I have created mentioned condition, but when I choose y
hi im new to jquery and im facing these problem i have these code
I'm facing following problem actually: I'm using Spring with jQuery. I have Controller: @Controller
I am relatively new to using jQuery and I have a problem with creating
Hi i have done with status update in tumbler but i am facing problem
I have code snippet like below I am facing problem when I click on
I´m facing this problem: I have a Button that works like a WrapPanel using
I am facing problem with connection time out,during jquery ajax operation. The problem scenario
i am facing one problem.i have a class named ReportingService and it should be
I'm facing a problem that seems to have no straighforward solution. I'm using java.util.Map

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.