I have two .on() functions for separate dynamically added elements, they are:
$('body').on('click', 'img', function() {
modal(content[$('li.active a').attr("href")].images[$("img").index(this)]);
});
$('body').on('click', 'img', function() {
closeM();
});
The second function, I have shortened to
$("body").on("click", "#close", closeM);
In looking at the jQuery documentation for .on(), I saw that I can do something like:
$("body").on({
click: function(){
},
mouseenter: function() {
}
});
I was wondering if I could either do something like that with my previous two functions, or if there was any other way of shortening/combining them.
onmethod \$\endgroup\$