I have a PHP script that throws out a bunch of buttons (Format in case it is needed):
<a class="ClassInfo" id="id">Name</a>
The file is retrieved dynamically and there can be as many buttons as possible, maybe none, and maybe a million (unlikely though).
I need to use JavaScript for this and can't just redirect the user to another website (mostly because the operation is repeated heavily and gets EXTREMELY tedious.).
Is it possible for me to use some combination of JavaScript + jQuery to detect which button was pressed and do an operation appropriately?
Example of what I am hoping for is this:
- User clicks one of the buttons (which has its unique id number).
- JavaScript detects which button was clicked (I can't just use fixed code as the number of buttons and the ids can change whenever they feel like it)
- JavaScript send out an Ajax request and does some fancy operations (I have this part covered)
Now is it possible for me to detect which button was clicked?
jQuery, and says "javascript + jquery", I'm guessing: Yes.javascripton).