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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:09:54+00:00 2026-06-09T20:09:54+00:00

i have this link which when clicked a modal dialog box will appear. <a

  • 0

i have this link which when clicked a modal dialog box will appear.

<a href="#" id="addtoteam">
    Add to Team
</a>

and this is the dialog box that will appear after the link is clicked,

$('#addtoteam').click(function(event){
      event.preventDefault();
      var url = '<?php echo BASEURL;?>';
      var teamID = '<?php echo $_SESSION['User']['Team']['id']?>';
      var playerID = $(this).attr('player-id');
      $( "#dialogbox" ).dialog({ 
        autoOpen: true,
        buttons: { 
                  "Use Registration Credits": function(){ 
                    // execute something here before redirecting it to another page, perhaps perform the updating of the registration_credits of each team here
                    window.location = url + '/administration/add_to_team/' + playerID +'/'+ teamID +'/?credit=1'; 
                  },
                  "Pay Extra Charge": function() { 
                  //$(this).dialog("close"); 
                    window.location = url + '/administration/add_to_team/' + playerID +'/'+ teamID +'/?proceed=1';
                  },
                  "Cancel": function() { $(this).dialog("close"); } 
                },
        width: 800
      });
    });

Now this is working, but it only works on the first link. You see my link is a list, for every line there is a link which looks like this,

`abc| def| ghi| Add to Teamlink`
`123| 456" 789| Add to Team link` and so on.

What bothers me is that when I click the abc| def| ghi| Add to Team link link the modal dialog box will appear but if I click any links other than the first link, the box will not appear. What seems to be the problem on my code? Thanks.

  • 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-09T20:09:56+00:00Added an answer on June 9, 2026 at 8:09 pm

    You’ll need to use a class name instead of an ID to select all ‘Add To Team’ links.

    <a href="#" class="addtoteam">
        Add to Team
    </a>
    
    <a href="#" class="addtoteam">
        Add to Team
    </a>
    
    <a href="#" class="addtoteam">
        Add to Team
    </a>
    

    JS:

    $('.addtoteam').click(function(event){
        //code
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a link which I want to display a modal dialog box, containing
I have this link which i need to translate in a php variable. http://www.facebook.com/dialog/apprequests?app_id=346824075388300&to=1149862205&message=Facebook+Dialogs+are+so+easy%21&redirect_uri=http%3A%2F%2Fpenelope-ns.net%2Ffb%2F
I have navigation elements that add a class to the clicked link, and removes
I have a link on the page which when clicked opens up a thick-box
I have this method defined since I will add a link button to each
I have this code: ie1.link(:text, /Exception:/) It is producing an error message which I
i have a DTD file which i used to accessed through this link: http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd
This may sound a weird question, I have a page which has a link:
I have this link in a template: <a href={% url show_item item.id %}>Item 1</a>
I have this link: <a href=data:application/pdf;base64,JVBERi0x...KJSVFT0YK>PDF</a> In Safari on MacOsX, clicking the link instantly

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.