[jQuery] Get the ID of a button that is clicked
I have a listing of records on a page and an "Edit" button for each
record. I want to write some jquery that fires when the button is
clicked to go to the edit page for the record whose button I clicked.
Here is what I have. Feel free to tel lme to do it completely
differently if there is an easier way. THANKS!
<script type="text/javascript">
$(function() {
$('#myGroup input:button').click(function(e) {
self.location = 'foo.cfm?id=' + I NEED TO GET THE ID OF THE BUTTON
CLICKED HERE
});
});
</script>
<div id="myGroup">
<input type="button" id="1" value="Edit">
<input type="button" id="2" value="Edit">
<input type="button" id="3" value="Edit">
</div>