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.
Get the ID by this:
$('.class').click(function() {
id = $(this).parent().attr('id');
});
This is in case the structure is div > a.class