One thing you could do is create a map between selectors and handlers:
var handlers = {
'.item' : function() {
//... do something
},
'.element' : function() {
//... do something different
}
}
Then you can assign the handlers in one swift iteration:
var $doc = $(document); // no need to wrap the document each time
for (var selector in handlers) {
if (handlers.hasOwnProperty(selector))
$doc.on('click', selector, handlers[selector]);
}
One more comment (see @ArunPJohny's comment), regarding efficiency. If you can get away with assigning the handler to an element lower in the DOM tree (farther from document), you should. In this construct:
$(static).on('click', dynamic, f);
For each click event that reaches an element in the $(static) collection, the dynamic selector is matched to see if f should be triggered. If static is the document, then all clicks in the page will be matched. If you can get a more specific element, less clicks will be matched. For clicks you might not notice a big difference, but events that are triggered faster (mousemove) may give you trouble.