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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:03:51+00:00 2026-06-06T00:03:51+00:00

I have the following code (in this case for two images – but in

  • 0

I have the following code (in this case for two images – but in reality, it could be replicated N times:

<figure title="" class="DragBox" dragableBox="true" style="opacity: 1;" id="thumb_1">
   <span class="pic" id='UAJ754'>
      <span class="imagewrap">&nbsp;</span>
    <span class="overlay">
      <a href="fulldata.php?UAJ754" class="popUpSimple" rel="thumb_1">Image Information</a>
    </span>
    <img src="/pics/UAJ754.jpg" alt="">
  </span>

  <figcaption class="AlbumFig_Caption">A picture caption.
  </figcaption>
</figure>
<figure title="" class="DragBox" dragableBox="true" style="opacity: 1;" id="thumb_2">
   <span class="pic" id='JB6732'>
      <span class="imagewrap">&nbsp;</span>
    <span class="overlay">
      <a href="fulldata.php?JB6732" class="popUpSimple" rel="thumb_2">Image Information</a>
    </span>
    <img src="/pics/JB6732.jpg" alt="">
  </span>

  <figcaption class="AlbumFig_Caption">A second picture caption.
  </figcaption>
</figure>

Now the span which has the class of ‘pic’ has a jQuery mousedown event associated with it – so that it doesn’t matter which image the mouse is clicked on, the pic tag will log the event and display a popup window with data. That all works fine.

But I need to obtain either the ID tag of the specific ‘pic’ that had the mouse down, or retrieve the src of the IMG so i can get the ID, as this needs to be passed to the popup window to display the correct info for the right picture.

I have the following JS code:

            $(".pic").mousedown(function(e) {   

                var mouseX = e.pageX; 
                var mouseY = e.pageY;

            if (e.which === 3) {                    

               $('.infobox').css({'top':mouseY+'px','left':mouseX+'px'}).fadeIn();

               var imgref = $(".pic").attr('id');
               alert (imgref);

               return false;
            }else{
               $('.info').fadeOut();
            }
        });

Again, this works fine, but it only gives me the ID of the first ‘pic’ span no matter which ‘pic’ span is clicked. How can I get the ID field of the current ‘pic’ span … the one that the mouse was over when the use pressed the button??

  • 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-06T00:03:52+00:00Added an answer on June 6, 2026 at 12:03 am
    var imgref = $('img', this).attr('src');
    

    you will get the src of the IMG.

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

Sidebar

Related Questions

I have the following code to do this, but how can I do it
I have the following problem. I have two classes, in this case A and
I have the following code -> something like Select case using LINQ - This
I have the following code: Bear in mind that while this code works on
I have this following code, here CssClass is of the String type. <asp:Panel ID=Panel1
I have this following code which will return all the current semesters. How do
I have the following code: Parallel.ForEach(this.listView2.CheckedItems, new ParallelOptions { MaxDegreeOfParallelism = 4 }, (CheckedItem)
I have following code for alertdialog: AlertDialog.Builder helpBuilder = new AlertDialog.Builder(this); helpBuilder.setTitle(Options); helpBuilder.setMessage(Choose Your
I have the following code: function Person(){ this.age = 30; } function Stats(){ this.age
I am using Jersey v10 and have written the following code.Is this the right

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.