Collapses the current selection to a single point. The document is not modified. If the content is focused and editable, the caret will blink there.
- The caret location will be within this node.
0 - Collapses the selection from the anchor to the beginning of
1 - Collapses the selection from the anchor to the end of
/* Place the caret at the beginning of an HTML document's body. */ var body = document.getElementsByTagName("body"); window.getSelection().collapse(body,0);