Would e.target.id also work in this case? Thanks, Anoop
On Mon, Aug 10, 2009 at 3:00 PM, Charlie Griefer <charlie.grie...@gmail.com>wrote: > Aye, but I've been reprimanded (on this list) for suggesting that (and > incurring the 'overhead' of a jQuery object) when 'this' works just fine :) > > > On Mon, Aug 10, 2009 at 11:56 AM, Eduardo Pinzon <edcpin...@gmail.com>wrote: > >> or >> <script type="text/javascript"> >> $(function() { >> >> $('#myGroup input:button').click(function(e) { >> >> self.location = 'foo.cfm?id=' + $(this).attr("id"); >> >> }); >> }); >> </script> >> >> >> 2009/8/10 Erich93063 <erich93...@gmail.com> >> >> >>> WOW I thought I tried that. That was my first instinct. I must have >>> had an error somewhere else. That worked. THANKS! >>> >>> On Aug 10, 11:50 am, Charlie Griefer <charlie.grie...@gmail.com> >>> wrote: >>> > this.id >>> > >>> > >>> > >>> > On Mon, Aug 10, 2009 at 11:48 AM, Erich93063 <erich93...@gmail.com> >>> wrote: >>> > >>> > > 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> >>> > >>> > -- >>> > I have failed as much as I have succeeded. But I love my life. I love >>> my >>> > wife. And I wish you my kind of success. >>> >> >> > > > -- > I have failed as much as I have succeeded. But I love my life. I love my > wife. And I wish you my kind of success. >