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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:51:41+00:00 2026-06-15T13:51:41+00:00

Now I have an html page that display image. Notice that the div only

  • 0

Now I have an html page that display image. Notice that the div only contain 1 image file:

<div="div_1"><img id = "img_1" src = '....' /></div>

What I would like to implement is when user double click on the div , through jquery/ js to get the “div_1” or “img_1” . In better way, get the “1” . Is it possible to implement / any function can help to achieve that?

Thanks

Updated:

The current Html code is like that

<div class="turn-page-wrapper" page="2" style="position: absolute; overflow: hidden; width: 28.5px; height: 37px; top: 0px; left: 0px; right: auto; bottom: auto; z-index: 6;">
<div style="position: absolute; top: 0px; left: 0px; overflow: hidden; z-index: auto; width: 47px; height: 47px;">
<div id="div_2" class="turn-page p2" style="width: 28.5px; height: 37px; -webkit-transform-origin: 0% 0%; position: absolute; top: 0px; left: 0px; bottom: auto; right: auto;">
<img id="img_2" src="demo/medium/Web081112_P002_medium.jpg" alt="flip book">
</div>
</div>
</div>

It seems my case is not that straight forward, when i use var id = $(this).attr("id"); it return page as result. If my case don’t allow me to get the attribute of page, the id of image, then it means i can not get the actual ID of individual image? thanks

Most Updated ( 1 flaw left only!)

$("div.turn-page").dblclick(function() {
var id = this.id;
num = id.split("_")[1];
alert (num);
});

Currently I am using this to get the id , however for the last result (not turn-able) when i double click it do not response or do anything. But it should be work since the class there is turn-page p7 ?

   <div class="turn-page-wrapper" page="7" style="position: absolute; overflow: hidden; width: 609.5922459893047px; height: 793px; top: 0px; right: 0px; left: auto; bottom: auto; z-index: 6;">
    <div style="position: absolute; top: 0px; left: 0px; overflow: hidden; z-index: auto; width: 1000px; height: 1000px;">
    <div id="div_7" class="turn-page p7" style="width: 609.5922459893047px; height: 793px; position: absolute; top: 0px; left: 0px; bottom: auto; right: auto;">
    <img id="img_7" src="demo/medium/Web081112_P007_medium.jpg" alt="flip book">
    </div>
    </div>
    <div style="top: 0px; left: 0px; overflow: hidden; z-index: 1; width: 610px; height: 793px;">
    </div>
    </div>
  • 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-15T13:51:42+00:00Added an answer on June 15, 2026 at 1:51 pm

    Like this:

    $("div").dblclick(function() {
        var id = this.id,
            num = id.split("_")[1],
            imgSrc = $(this).find("img").attr("src");
    
        // do something with the id, the number, or the image src
    });
    

    Demo: http://jsfiddle.net/LGwK7/

    This will bind a double-click handler to all div elements, so you might want to add a common class to just the ones you care about and bind to those. (I’m assuming it doesn’t make sense to bind by id because you asked how to get the id of the clicked one.)

    Note that your html has an error: <div="div_1"..., should be <div id="div_1"...

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

Sidebar

Related Questions

I have a messy html that looks like this: <div id=:0.page.0 class=page-element style=width: 1620px;>
On this page: http://www.ubhape2.com/formhelp.html I have 3 file uploads. I have it set now
I have a simple flow: A.html -> B.html -> C.html Now, page B either
I have a jQuery ajax call that returns html of a table. Now I
I have a website that right now, runs by creating static html pages from
I am new to Css. I have an HTML page. <body> <div id=viewer> <div
I have a small flash file that just loads and shows one image scaled
I have a page that display some data. It is loaded from a database
I have an html page. On that page I want to open popup window.
I have a page that has 7 image boxes, these boxes are alert boxes

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.