Possible Duplicate:
Bind function to multiple events of different elements at once
I need to execute the same code for both a link click and change event
$(".foo").click(function() {
//same code
}
$(".bar").change(function() {
//same code
}
The normal way I would achieve is to create a function and then fire the function on each seperate event - but I'm wondering if jquery has an easier way to handle this, similar to
$(".bar, .foo").
But obviously with different event methods.
To clarify i need one to click and one to change but NOT both to click and change, does that make sense?