Example:
$(document).click(function() { blah });
// and
$(\'html\').click(function() { blah });
document
is a DOM Element which wraps the HTML - DOM Element
whereas html
is the HTML DOM element
. document
includes the
first line of the document - the one which specifies the doctype
. For ex. (for HTML 5)
class, id and other attributes
whereas document
doesn't have (and can't have) these attributes
. Try $(document).addClass('test') v/s $('html').addClass('test');
and notice the difference on the elements tab on developer console
.Good Luck...