Jump to content

Recommended Posts

I'm sure this is a fairly rudimentary question and I have done it before in the past but I can't seem to recall how nor find it anywhere online.

I have right now something that looks like this in HTML:

<a href="#" class = "up">UP</a><span class="score" id="score_2">5</span> points.

 

The anchor tag is a bit redundant and I am likely going to remove it and just throw span tags around it.

I have a bit of jquery that says when anything with the class "up" gets clicked to send a request to a php script and update the score with the results. The only thing is that right now its all hard coded as far as what score will be updated because I can't remember how to get the event information.

Basically I need to be able to view the id of what was clicked, even though the click event is triggered based on the class. Can anyone help? I'm sure it has something to do with "this" but I can't recall what exactly.

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/220066-jquery-get-event-information/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.