For versions of IE below 10 that do not support the dataTransfer method, I discovered another rather hacky way to make this work.
Basically you make the text invisible with css, then use js to select it in the background on hover.
HTML
<div id="drag_area" draggable="true"> <div id="text"> hidden text </div> </div>
CSS
#text { filter:alpha(opacity=0); opacity:0; overflow:hidden; z-index:100000; width:180px; height:50px }
Js
function selectText(elementID) { var text = document.getElementById(elementID); if ($.browser.msie) { var range = document.body.createTextRange(); range.moveToElementText(text); range.select(); } else if ($.browser.mozilla || $.browser.opera) { var selection = window.getSelection(); var range = document.createRange(); range.selectNodeContents(text); selection.removeAllRanges(); selection.addRange(range); } else { var selection = window.getSelection(); selection.setBaseAndExtent(text, 0, text, 1); } } $('#drag_area').hover(function(){ selectText('text'); });
Here it is combined with Anson's solution and a small sign: <Up> http://jsfiddle.net/zaqx/PB6XL/udap> (works in IE8, IE9 and in all modern browsers)
EDIT: Updated Fiddle in the comments below.
source share