tags:

views:

36

answers:

1

Hi,

if I have :

$('.someClass', $('#context1,#context1')).bind('click',
    function(e){
    // XXX
    }
);

how can I know in point XXX , which context (context1 or context2) is the one that the .someClass element was clicked ?

Thanks, greetings

+2  A: 

This should work

$(this).parents().filter("#context1,#context2")

Edit: My previous example had find instead of filter, I've fixed it

MBO
I was wondering if its possible to get the context somehow from the event object!? Thanks anyway, I think that works as well.
Paul
Unfortunately event object is only DOM object, and has no knowledge about jQuery contexts and objects. You can't event get context from first object, because jQuery object is collection of selected DOM objects, each with it's own path.
MBO