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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:34:09+00:00 2026-06-05T08:34:09+00:00

I am retrieving 9 image thumbnails from a database, each resides in its own

  • 0

I am retrieving 9 image thumbnails from a database, each resides in its own div like so:

<div class="post">

<div class="post_desc"></div>
<div class="post_title"></div>
<a href="#" class="linktopost">**<img src="img/thumb.png" class="thumb-img"/>**</a>
<form>
**<input type="hidden" class="postid" value="'.$post_id.'" />**
</form>

</div>

Using Jquery I am trying to post the value that is in the hidden input field when the thumbnail is clicked but I am struggling to select it correctly. The value in the input changes with each of the 9 images.

This is how far I have got with the Jquery:

$(".thumb-img").click(function(){

    $.post("inc/fullpost.php", {postid: ##########.val()},
        function(output){
            $("#gotpostid").html(output).show();
        }).fail(function(x,y,z){ 
            $("#gotpostid").html(x + "<br />" + y + "<br />" + z)
        });

});

So how do I correctly select the value in the input field that resides in the same containing class as the image thumbnail?

  • 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-05T08:34:11+00:00Added an answer on June 5, 2026 at 8:34 am

    You can use data instead of hidden elements. Remove hidden element,and try like this:

    Markup:

    <img src="img/thumb.png" class="thumb-img" data-postid="'.$post_id.'"/>
    

    Script:

    $(".thumb-img").click(function(){
        $.post("inc/fullpost.php", {postid: $(this).data('postid')},function(output){
                $("#gotpostid").html(output).show();
            }).fail(function(x,y,z){ 
                $("#gotpostid").html(x + "<br />" + y + "<br />" + z)
            });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am retrieving a Blob image from a database, and I'd like to be
I am retrieving an image from the SQL database into Byte() variable in VB.NET.
I'm currently retrieving image data from an iSight camera and I'd like to hand
I'm retrieving a batch of items using their keys, with something like this: from
I am retrieving a couple of tables from a MSSQL database, which I am
I'm retrieving image from DB using Stream. Need someone to help me to convert
I am trying to retrieving image from sql server 2005 into asp.net web page
I am retrieving an image from my SQLite table and converting it to a
I am retrieving an image(as a Bitmap) from res/drawable folder and displaying it using
I am using this to get image bytes from the database cmd.CommandText = select

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.