This is the syntax for a delegated event:
$(document).on('mouseeenter','.foo', function(){});
Here is the syntax for multiple events (without delegation):
$('.foo').on({
mouseenter: function(){
//stuff
},
mouseleave: function(){
//stuff
}
});
I'm wondering if there's a cleaner way to do this:
$(document).on('mouseenter', '.foo', function(){})
.on('mouseleave', '.foo', function(){});
$(document).on({
mouseenter: function(){
//stuff
},
mouseleave: function(){
//stuff
}
}, '.foo');