This is how to bind multiple events on a couple jQuery selectors:
$('#selector1,.selector2').bind('event', function (e, ui) {
// Stuff
});
But! How do you bind on predeclared jQuery objects. Example:
var jSelector1 = $('#selector1');
var jSelector2 = $('.selector2');
Because, the following doesn't work:
jSelector1,jSelector2.bind(...);
nor does:
$jSelector1,$jSelector2.bind(...);
($jSelector1,$jSelector2).bind(...);
(jSelector1,jSelector2).bind(...);
This should work, assuming your variables hold jQuery objects
$.each([jSelector1, jSelector2], function(i,v) {
v.bind( ... );
});
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