I'd like to bind an event to an element and its children. What is the best way to do this?
$(element).bind('click', function(event) {
doSomething();
});
I'd like to bind an event to an element and its children. What is the best way to do this?
$(element).bind('click', function(event) {
doSomething();
});
The code you have will do just that.
Look in the event's
target
field to find out which actual child node saw the event.