Forum Moderators: open
PD: I dont whant to know the selection type, I whan to know the exact content of a text selection.
<head>
<script type="text/javascript">
// IE only!
function getSelection()
{
return document.selection.createRange().text;
}
// IE only!
function getSelectionHTML()
{
return document.selection.createRange().htmlText;
}
</script>
</head>
Somebody <b>please</b> select me.
<body>
<button onclick="alert(getSelectionText())">get text</button>
<button onclick="alert(getSelectionHTML())">get html</button>
</body>
(more IE-related)
Tutorial:
[course.com...]
MS:
[msdn.microsoft.com...]