event.target returns a native dom element. You can then wrap that element with $() to use all of jQuery's methods. var element = event.target; $(element).attr('id'); // returns the id of the element element.getAttribute('id'); // also returns the id in native javascript, but does not work in IE (of course...)
I hope this helps! :) -Hector On Tue, Nov 18, 2008 at 11:51 AM, Mark Steudel <[EMAIL PROTECTED]> wrote: > > Thanks that worked great. I don't have much experience working with > events, and I'm having troubles finding out how to access various > properties of the event.target, do you have suggestions/links? I guess > I'd like to know the id and the name, thanks! > > On Nov 18, 10:53 am, "Hector Virgen" <[EMAIL PROTECTED]> wrote: > > An event object is always passed as the first argument to the function, > > which contains the information you need. > > $('#form').submit(function(event) > > { > > // Get the element that fired the event > > var element = event.target; > > > > }); > > > > For more info check out the Events guide: > http://docs.jquery.com/Events_(Guide) > > > > -Hector > > > > On Tue, Nov 18, 2008 at 10:47 AM, Mark Steudel <[EMAIL PROTECTED]> > wrote: > > > > > Hi I have a form that has two submit buttons I am utilizing the > > > following ajaxSubmit code: > > > > > $("#form").submit( function() { > > > $(this).ajaxSubmit({ > > > target: '#response' > > > }); > > > > > return false; > > > } > > > ); > > > > > Inside the submit function is there a way to figure out which button > > > was clicked? I tried doing something like > > > > > $(this).attr("id") > > > > > but it gives the id of the form, not the button .... > > > > > TIA >