Create Draggable DOM element Using jQuery

Create Draggable DOM element Using jQuery

Please check this following example.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery Draggable</title>
  <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  
  <style>
  #draggable { width: 150px; height: 150px; padding: 0.5em; border:0}
  </style>
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
  $( function() {
    $( "#draggable" ).draggable();
  } );
  </script>
</head>
<body>
 
<div id="draggable" class="ui-widget-content">
  <img src="https://i0.wp.com/jigneshdarji.com/wp-content/uploads/2018/04/Dummy-Image.jpg?ssl=1"/>
</div>
 
 
</body>
</html>

Please check the output: