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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:06:23+00:00 2026-06-06T11:06:23+00:00

Everything is there in the title itself. I am trying to create a custom

  • 0

Everything is there in the title itself. I am trying to create a custom tweet button with callback. I have pasted the code below. I am not using the Twitter Button code from twitter as I have a multiple tweet buttons on the same page and I want to pass a unique id to each callback according to which button was clicked.

First time the button is clicked, the popup opens for tweet and after tweeting, window closes but callback function is not called. Second time I click the same button (without reloading the page), the callback function is called! Any I idea why this is happening and how this can be corrected to work on first click?

Thank you all.

<a href="#" target="_blank" id="twtShareLink" 
               onclick="return twOpenPopup('<URL>','<TEXT>','<UNIQUE_ID>')"
               >Tweet It!</a>

JS:

function twOpenPopup(url,text,unique_id){
        twttr.events.bind('tweet',function(event){
               alert('Here');
               //Code that uses unique_id here;
        });
        var twturl="https://twitter.com/intent/tweet?url="+encodeURIComponent(url) + 
            "&count=none&source=tweetbutton&text=" + encodeURIComponent(text) + "&original_referer=" + encodeURIComponent('<?= $_SERVER['HTTP_HOST'] ?>');
        document.getElementById("twtShareLink").href = twturl;
        return true;
    }
  • 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-06-06T11:06:25+00:00Added an answer on June 6, 2026 at 11:06 am

    Because you’re not binding your event until you click on the button. You need to bind the event outside the twOpenPopup() function.

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

Sidebar

Related Questions

When I use the code provided below everything works fine unless there is an
like in title:) I wrote from tutorial: http://msdn.microsoft.com/en-us/wp7trainingcourse_yourfirstwp7applab_topic3 does everything like there. my code:
Is there a reason why I should not be marking everything as public in
So I have been working with Wordpress 3.x and trying to build a custom
I think everything is in the title. Is there any way to add a
The title sort of says it all. I have a text file (NOT a
i repeat the title because everything is there : How to pass a variable
Well, almost everything is in title. I have a dbf file which I would
I think there is everything in the title but let me make an example
Everything in on the title, is there a way to extract the list of

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.