Skip to content

Instantly share code, notes, and snippets.

View okonet's full-sized avatar

Andrey Okonetchnikov okonet

View GitHub Profile
@juliocesar
juliocesar / selection.js
Created May 23, 2011 06:11
Get the current selection in JS
function selection() {
return window.getSelection ? window.getSelection().toString() :
document.getSelection ? document.getSelection().toString() :
document.selection ? document.selection.createRange().text :
false;
}
<!DOCTYPE html>
<html>
<head>
<title>Spinner</title>
<meta charset="utf-8">
<style>
canvas, a { display: block; }
</style>
</head>
<body>