I want to do a simple drag-drop using jQuery. I have not done anything so far, but previous attempts were unsuccessful.
The HTML Drag and Drop API relies on the DOM's event model to get information on what is being dragged or dropped and to update that element on drag or drop. With JavaScript event handlers, you can turn any element into a draggable item or an item that can be dropped into.
Now HTML 5 came up with a Drag and Drop (DnD) API that brings native DnD support to the browser making it much easier to code up. HTML 5 DnD is supported by all the major browsers like Chrome, Firefox 3.5 and Safari 4 etc.
Have you tried jQuery UI Draggable? Simple use case:
<script type="text/javascript">
$(function() {
$("#draggable").draggable();
});
</script>
<div id="draggable" class="ui-widget-content">
<p>Drag me around</p>
</div>
Online Demo Created.
See this please.
Other Option:
JQuery Drag & Drop Plugin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With