 <pre><code> use the following code ====================== function allowDrop(ev) { ev.preventDefault(); } function drag(ev) { ev.dataTransfer.setData("Text", ev.target.id); } function drop(ev) { ev.preventDefault(); var data = ev.dataTransfer.getData("Text"); ev.target.appendChild(document.getElementById(data)); } &lt;input type="text" ondrop="drop(event)" ondragover="allowDrop(event)"&gt; and use this url for viewing : http://jsfiddle.net/zLYGF/25/ </code></pre>