Is binding a click event to document better than binding it to body?

后端 未结 5 1964
逝去的感伤
逝去的感伤 2021-02-20 15:55

The question is simply between

$(\"body\").click(function(e){}); vs $(document).click(function(e){});

which is more efficient or advisa

5条回答
  •  醉话见心
    2021-02-20 16:33

    I would say it's better to bind event to document as in some cases in some browsers body may be missing.

提交回复
热议问题