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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:54:00+00:00 2026-05-15T23:54:00+00:00

iterating over an array, am printing some div content for each iteration. Whenever the

  • 0

iterating over an array, am printing some div content for each iteration.
Whenever the user clicks on any div content, a popup should appear and should show the corresponding content in the popup from the array.

below is my code,

foreach ($email as $client)
{

                echo "<div class = 't'> Show more....... </div>";
                echo "<div class='popup_msg'>";
                echo $client['Email']['body'];
                echo "</div>";

}

javascript code below

jQuery(document).ready(function(){

jQuery('.t').click(function(e)
{
  var height = jQuery('.popup_msg').height();
  var width = jQuery('.popup_msg').width();
  leftVal=e.pageX-(width/1.5)+"px";
  topVal=e.pageY-(height/13)+"px";

  jQuery('.popup_msg').css({left:leftVal,top:topVal}).show();
});

jQuery('.popup_msg').click(function(e)
{
jQuery('.popup_msg').fadeOut('fast');
});


});

in the above codes, what i want to achieve is, whenever the user clicks on the div with class t, the corresponding $client[‘Email’][‘body’] should appear in the popup

  • 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-05-15T23:54:01+00:00Added an answer on May 15, 2026 at 11:54 pm

    The problem is that your selector matches all .popup_msg, not only the one you need. Use the find() method to get the correct popup in the $(‘.t’).click function:

    jQuery('.t').click(function(e)
    {
          var popup_msg = jQuery(this).find('.popup_msg');
          var height = popup_msg.height();
          var width = popup_msg.width();
    
          leftVal=e.pageX-(width/1.5)+"px";
          topVal=e.pageY-(height/13)+"px";
    
          popup_msg.css({left:leftVal,top:topVal}).show();
    });
    

    Note: I haven’t tested this code, it might not be 100% correct but hopefully you get what I mean.

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

Sidebar

Related Questions

I want avoid iterating over a nil array. My bad solution: if nil!=myArr myArr.each
When iterating over a large array with a range expression, should I use Python's
I am iterating over an array which contains filenames. For each of them, I
The template {{each}} directive works great for iterating over an array like this: var
Is there a better shorter way than iterating over the array? int[] arr =
I have the following issue related to iterating over an associative array of strings
I am iterating over an array in python: for g in [ games[0:4] ]:
Let's say I'm iterating over an array of Objects i.e. for (int r =
I'm iterating over some api data and mapping the API's data to Coffeescript objects.
I'm iterating over an array of nids. Now I need to check whether the

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.