I am wondering if it is possible to combine multiple actions to the same on() function?
My code:
$(document).on('mouseout', '#tip', function() {
$('#tip .ttip').show();
});
$(document).on('click', '#tip', function() {
$('#tip .ttip').show();
});
I have tried the following, but they both did not work.
$(document).on('mouseout, click', '#tip', function()
$(document).on({'mouseout', 'click} '#tip', function()
You almost had it ..
You need to use a space between the events
Although, binding to the
documentis frowned upon. It mimics the.livemethod which has been deprecated for this reason (and a few others).Quote
See the docs at http://api.jquery.com/on/
Quoting