What is the significant difference between the following two?
$('body').on('click','#selector', function{...})
$('#selector').on('click', function{...})
I have noticed that the first one more of dynamic thing. If I have static selectors, which should I use? What is the performance? What is prefered?
And Is it that: Always use delegation? What are the side effects?
Answer here explains the use of both: Direct vs. Delegated - jQuery .on(). I wanted to see the performance and best practices to do.