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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:06:36+00:00 2026-06-17T08:06:36+00:00

this is in a php loop; echo <td><a id=’gbdetail’ href=’#gbdetay’ data-toggle=’modal’ onClick=’getGBdetay()’ class=’btn btn-small’

  • 0

this is in a php loop;

echo "<td><a id='gbdetail' href='#gbdetay' data-toggle='modal' onClick='getGBdetay()' class='btn btn-small' data-original-title=' click to see detail ' data-placement='left' rel='tooltip' href2='lookgb.php?gbid=".$wrgb['id']."'>"."<i class='gicon-edit'></i></a></td>";

and this is jquery part;

function getGBdetay()  { 
    $('#gbdetail').click(function(){
        var url = $(this).attr('href2'); 
        $("#gbbody").load(url); 
    }); 
};

it works only for first row, content doesnt loading in other rows. what can cause this?

Edit:

it worked with changing selector. but now it doesnt work on first click. on first click content doesnt loading. after first click it works without problem. why doesnt it working on first click?

    function getGBdetay()  { 
  $('.btn.btn-small.gbdetayl').click(function(){
   var url = $(this).attr('href2');
   $("#gbbody").load(url);
});

 echo "<td><a target='_blank' href='#gbdetay' data-toggle='modal'  onClick='getGBdetay()' class='btn btn-small gbdetayl' data-original-title=' click to see detail ' data-placement='left' rel='tooltip' href2='lookgb.php?gbid=".$wrgb['id']."'>"."<i class='gicon-edit'></i></a></td>";
  • 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-17T08:06:37+00:00Added an answer on June 17, 2026 at 8:06 am

    Because you can only IDs once in the page.

    You can give the <a>s the same class instead of the same ID and then you can use that to select all elements on. You have used btn as class so you can do

    function getGBdetay()  { 
        $('.btn').click(function(){
            var url = $(this).attr('href2'); 
            $("#gbbody").load(url); 
        }); 
    };
    

    Every button will then have this onclick function. It might be needed to add another class or another way to select all links.

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

Sidebar

Related Questions

I have this PHP in a while loop: echo <td><a href='#' class='po'> . $row['order_no']
Using PHP I echo out table rows in a loop like this: <?php /*
I am using a foreach loop within PHP similar to this: foreach ($class->getAttributes() as
I have this php echo statement for a checkbox that is in a loop:
So I have this simple PHP loop that is generating html table data with
Hi I am using this code to pass a data-testid parameter --- php loop
This is my php code: echo '<div class=code rel=$url>$title</div> <div class=tip>Copy and open site</div>';
$data = json_decode($data, true); a php foreach loop on this $data variable foreach($data as
Possible Duplicate: php loop through associative arrays i have this piece of code which
I have this PHP code in a loop for every post on the admin

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.