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

  • Home
  • SEARCH
  • 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 6975147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:19:51+00:00 2026-05-27T17:19:51+00:00

i have php while loop, creates many classes, displaying info (user posts ect) and

  • 0

i have php while loop, creates many classes, displaying info (user posts ect) and two buttons at the bottom of the post, num sends a numerical value (Increments and decrements on click of the two buttons respectively), however i would like to know how to (onclick) get the ID of the Post that the button was clicked in so i can insert the value of num into a database with the POSTID being the ID of the post in the class in which the button was clicked.

  • 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-27T17:19:52+00:00Added an answer on May 27, 2026 at 5:19 pm

    Get the ID by this:

    $('.class').click(function() {
        id = $(this).parent().attr('id');
    });
    

    This is in case the structure is div > a.class

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

Sidebar

Related Questions

I have an index.php with loop <?php if (have_posts()) : ?> <?php while (have_posts())
I have been tearing my hair with this one for a while. index.php: $(document).ready(function(){
I have php script that creates a temporary watermark image for users that are
I'm making a Calendar in PHP, and I have a for loop for 31
I have a template file ( trendingPosts.php ) for showing 2 latest posts with
Inside my php I have a function which creates a connection to my db,
I have a table that's generated by a normal PHP loop. What I want
I have the following PHP that creates some JSON from a MySQL query. This
<?php $i = 1; $y = 5; ?> <?php while (have_posts()) : the_post(); ?>
I have PHP configured so that magic quotes are on and register globals are

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.