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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:07:53+00:00 2026-06-12T14:07:53+00:00

I am trying to place a jquery modal popup button against each row in

  • 0

I am trying to place a jquery modal popup button against each row in a table meaning there could be up to 25 buttons on a page – each button needs to popup a dialog containing different content pulled from a database based on the id of the row.

I can get the button to work and display the content properly if it is shown once on the page outside the loop but as soon as I put it into the loop it starts behaving very oddly. When I click any of the buttons it displays the popup with the dynamic content inside but clicking exit cycles through the loop and shows all the dynamic content until all the rows have been shown.

For example, if I have 4 rows when I click button one I get a popup with the content for row one but if I click exit it then shows the content for row two and so on until they have all been shown which is obviously not correct.

How can I get it so it only shows the popup once and only shows the corresponding id rather than all of them?

<script>
// increase the default animation speed to exaggerate the effect
$.fx.speeds._default = 100000;
$(function() {
    $( ".jui-dialog" ).dialog({
        autoOpen: false,
    modal: "true"
    });

    $( ".button" ).click(function() {
        $( ".jui-dialog" ).dialog( "open" );
        return false;
    });
});
</script>


<begin loop>

<button class="button">Popup</button>
<div class="jui-dialog">
    <div class="jui-dialog-inner">
        <p><?=$id?></p>
    </div>
</div>

<end loop>
  • 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-12T14:07:54+00:00Added an answer on June 12, 2026 at 2:07 pm

    If you don’t want to change your dom, you might select the dialog which is just after your button :

    $( ".button" ).click(function() {
        $(this).parent().children().eq($(this).index()+1).dialog( "open" );
        return false;
    });
    

    But giving an id to your button would be cleaner :

    <button class="button" id="<?=$id?>">Popup</button>
    <div class="jui-dialog" for="<?=$id?>">
        <div class="jui-dialog-inner">
            <p><?=$id?></p>
        </div>
    </div>
    
    $( ".button" ).click(function() {
        $('.jui-dialog[for="'+this.id+'"]').dialog( "open" );
        return false;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to place a button just below/after an image with Jquery. The button
I'm trying to be able to place the error message when using jQuery validation
I'm trying to place a button. I have its position set to absolute, so
I am using jQuery and trying to load a variable in place of a
Hi there Im trying to do a few things with jQuery validation plugin and
I'm currently trying to put into place Jquery UI to enable drag and drop
I'm trying to call a facebox modal box (flow player's jQuery Tools). I have
I am trying to write my own edit-in-place using jQuery. My code is something
I am looking at trying to place a hover() method onto each array element.
I am trying to use Jquery Dialog box in place of Java script standard

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.