[removed] Whats the difference between 'Document' and 'HTML'

后端 未结 4 1532
一整个雨季
一整个雨季 2021-01-02 16:26

Example:

$(document).click(function() { blah });   
// and
$(\'html\').click(function() { blah });
4条回答
  •  生来不讨喜
    2021-01-02 16:47

    try to put out the innerHTML of both, whats the result? i reckon (but han't tested) that

    • document is really the complete document, including and all elements in it
    • html references the -tag, so there will only be the and in your output, not the -tag itself

    but: for your code (adding an click-handler) there would be no difference, because clicking into the document will always be a click on the (as long as you site is valid and has an -tag)

提交回复
热议问题