问题描述:

This question already has an answer here:

  • Global vs. local event handler binding for jQuery widget [closed]

    2 answers

网友答案:

second one is better , faster performance wise.. your are delegating the event to the closest static parent which is always better than the document itself..as it doesnot have to traverse through all the elements and document as a whole

网友答案:

Performance.

Though you would use the first one in the event that the element you are attaching the event handler to was inserted into the DOM after page load.

相关阅读:
Top