JQuery: binding a single event listener that can handle events of its children?

Check out delegate() — it's exactly what you're asking for.

Check out delegate() — it's exactly what you're asking for. $('ul. Mylist').

Delegate('a', 'click', function() { // ... your code ... }); You get all the benefits of a jQuery handler, without having to do the binding to all those elements.

1 I forgot about delegate(). – alex Jun 2 at 0:50 Thanks, Pointy! – Stephen Jun 2 at 0:57.

You can access event. Target, which will be the element that started the event. $('.

MyList'). Click(function(event) { var target = $(event. Target); }); jsFiddle.

However, Pointy's answer seems to be easier to use.

Also, useful to know, but I agree with you that .delegate() is easier to use. – Stephen Jun 2 at 1:01.

The function you attach will have an event parameter that contains the object which is clicked in event.target. $(.....). Click(function(event){ .... }); Another solution, more complex, but more flexible too, although you won't need it in this situation, is to use the .

Bind method and specify a data object $(.....). Bind('click', {whateverproperty: whatevervalue}, function(event){ ... }); In that case, you can reach event.data. Whateverproperty, thus retrieving the value whatevervalue, allowing you to make more complex decisions.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions