Possible Duplicate:
Jquery event chaining
Traditionally we may write:
$("selector").click(function () {
});
but is it possible to chain events, something like so:
$("selector").click,keyup,keydown(function () {
});
I'm aware of the fact that I could write a function and reference that function in three seperate handlers, but this would be cleaner.
Use .bind()
$("selector").bind("keyup keydown click", function () {
});
For jQuery 1.7 and later, using the new API .on() is more preferred
$("selector").on("keyup keydown click", function () {
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With