Jump to content

Jquery get event information


proggR

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.