jQuery event handling - bind to document or 'body' element?

后端 未结 5 933
长发绾君心
长发绾君心 2020-12-31 01:36

I have noticed the use of $(document) and $(\'body\') when we want to reference the entire page, especially when binding events.

$(         


        
5条回答
  •  一生所求
    2020-12-31 01:43

    'document' keyword is just a handle on the object that contains the whole HTML Document. On the other hand In jQuery, $('body') contains the body portion the HTML document. But in reality, you won't notice a difference of behavior between them.

    For any further information about several jQuery functions and their working procedure, visit: jQuery function

提交回复
热议问题