I want a click on a span tag with .myClass ,and all its descendants, to do something..
$('.myClass'). *<all elements below .myClass>*.click(function(){
//do something
});
How do i select all elements below the .myClass selector ? Not only children, but every node below them aswell.
Im in IE7
A click by default will bubble up to the parents, so you just need:
If you really do need all elements, use
$('.myClass *'), but typically you want to stay away from this, event bubbling is much more efficient and happens by default. If you need the target, seeing which actual child it came from useevent.target, like this: