views:

92

answers:

2

What does $("html") mean?

i.e. $("html").scrollTop(0);

+6  A: 

It means to select the <html> element in the page, and scroll to it's top position. Since that's the very top of the document, you're scrolling the browser all the way up.

Nick Craver
+2  A: 

$("html") selects all elements of the type html. And that’s the root element in HTML. The same can be done with $(document) or $(document.documentElement).

Gumbo
Are you sure that $('html') == $(document)?
Sinan Y.
is this true? I didn't think the root <html> tag had all the same properties as the document object does.
Mike Sherov
@Sinan Y.: You’re right. `$(document)` refers to the document and not the root element.
Gumbo