I always find that I have multigrid selectors with click events in many areas of code. Is there a drawback to doing so?
Example:
$('#id').live('click'....)
$('div').live('click'....)
$('.class p').live('click'..)
or better, that all be combined into one selector, for example
$('#id, div, .class p')..
Sometimes it’s difficult for me to combine everything on one selector, because I need to know which element was pressed. Not all elements have identifiers. some of them have some classes, and some are just html tags. If it's best to combine everything in one selector, how can I determine which of the elements clicked.
source
share