var selection = getSelection(); var range = selection.getRangeAt(0); range.selectNodeContents(document.body);