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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:16:53+00:00 2026-06-01T21:16:53+00:00

How would you use simplemodal within a foreach loop so that it does not

  • 0

How would you use simplemodal within a foreach loop so that it does not repeat the same information?

Example:

foreach($ret as $v)
{
        <div id='osx-modal'>
        <input type='button' name='osx' value='View' class='osx demo'/>
        </div>

        <div id="osx-modal-content">
            <div class="close"><a href="#" class="simplemodal-close">x</a></div>
                <div id="osx-modal-data">                                                                                               
                    <div id="toon_box">

                        <div id="toon_name">
                            <?php echo $v['toon_name'];?>
                        </div>

            <div id="toon_avatar">
                            <?php echo '<img src="' . $v['avatar'] . '" alt="" />';?>
                        </div>
                    </div>
                </div>
}

The meta data is pulled from users on the website and displays that meta data for each user in separate Modals. For clarification let’s say foreach is repeated 10x since here is 10 users in the database. That will create 10 separate buttons for each user, that when you click the modal box pops up with the data inside of it.

The problem is, that when you click each button its the same user in each modal box. How would you set this up so each modal box displays the correct user meta data. I’ve already checked if persistence is set to false in simplemodal.js and it is.

  • 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-01T21:16:55+00:00Added an answer on June 1, 2026 at 9:16 pm

    Finally got it to work thanks to standup75!

     jQuery(function ($) {
      var OSX = {
          container: null,
          init: function () {
                  $("[name=osx]").click(function (e) {
                    e.preventDefault(); 
                    $(this).parent().next().modal({
                        overlayId: 'osx-overlay',
                        containerId: 'osx-container',
                        closeHTML: null,
                        minHeight: 80,
                        opacity: 65, 
                        position: ['0',],
                        overlayClose: true,
                        onOpen: OSX.open,
                        onClose: OSX.close
                    });
                });
          },
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How you would use jQuery to implement a div that executes a link when
I would like to create an application that would use the same system as
I am writing a Facebook application that would use a Postgres DB along with
Can I use generateDS.py in python in a similar way that I would use
I can use Eric Martin's simplemodal somewhat. But I would like to call it
How would I use ColorBox to create a 'confirm override' modal dialog that can
For one domain I would use this RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^example-domain-please-change\.com [NC]
I would like an alogrithm that would use only shift, add or subtract operations
What are some situations that you would use XHTMLRenderer (flying saucer) over JTextPane with
I would use the System.Linq.Dynamic . I added the specified Dynamic.vb file, that starts

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.