'this', in the context of your handler function, is the DOM node that triggered the event. You probably want something like:
function delete_photo() { var url = this.href; // or $(this).attr('href'); ... } $('.delete_photo').bind('click', delete_photo); Usually this kind of thing is written with an anonymous function, like so: $('.delete_photo').bind('click', function() { var url = this.href; // or $(this).attr('href'); ... }); --Erik On 8/16/07, Dundee <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm quite new to jQuery. I have one problem in my JS scripts and I > don't know how to solve it. > > I have a cripts which binds click event of A (class delete_photo) with > function delete_photo. This function needs to know who called it, or > get the href attribute (to be able to use this href in ajax calling). > > I have tried two ways: > > 1) > $('.delete_photo').bind('click',{ url: $ > ('.delete_photo').attr('href') }, delete_photo); > > 2) > $('.delete_photo').bind('click',{ url: this.attr('href') }, > delete_photo); > > But both are wrong. The first one passes href attribute of first A > everytime, second one throws exception. > Can someone give me some advice? > > Thanks > > Daniel Milde > Milde.cz > >