Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
  
</head>
<body>
  <p>This is a paragraph of text that allows you to test the getSelection() method on this page. Try it out by selecting a portion of the text.</p>
  
  <p>This is a paragraph of text that allows you to test the getSelection() method on this page. Try it out by selecting a portion of the text.</p>
  
  <p>This is a paragraph of text that allows you to test the getSelection() method on this page. Try it out by selecting a portion of the text.</p>
  
  <p>This is a paragraph of text that allows you to test the getSelection() method on this page. Try it out by selecting a portion of the text.</p>
  
  <output></output>
</body>
</html>
 
var d = document,
    w = window,
    o = d.querySelector('output');
d.addEventListener('mouseup', function () {
 o.innerHTML = w.getSelection();
}, false);
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
ImpressiveWebspro
0viewers