<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
#firstbox, #secondbox {
float:left;padding:10px;margin:10px; -moz-user-select:none;
}
#firstbox { background-color: #F60; width:100px; height:80px; color:#FFF; }
#secondbox { background-color: #069; width:100px; height:80px; color:#FFF; }
</style>
<script type="text/javascript">
function dragStart(ev) {
ev.dataTransfer.effectAllowed='move';
ev.dataTransfer.setData("Text", ev.target.getAttribute('id'));
ev.dataTransfer.setDragImage(ev.target,0,0);
return true;
}
</script>
</head>
<body>
<center>
<h2>HTML5 Drag and drop </h2>
<div>Try to drag the Blue Box.</div>
</center>
<center>
<div id="firstbox" draggable="true"
ondragstart="return dragStart(ev)">
<p>Drag Me</p>
</div>
<div id="secondbox">Secondbox</div>
</center>
</body>
</html>
Drag Me