I have ten blocks of code like this, it is all for dynamically created content:
$(document).on('click', '.item' , function() {
//... do something
});
$(document).on('click', '.element' , function() {
//... do something different
});
Is there a way to write this shorter or more efficient?
You could cache your document selector.
But that's about it.
Edit: Contribute a test to my jsPerf if you want hard data.