Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<link href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <button id="addButton">Add New Square</button>
  
  <div class="container">
    <div class="draggable">Original</div>
    <div class="draggable">Original</div>
    <div class="draggable">Original</div>
  <div>
</body>
</html>
 
.draggable { 
    width: 75px; 
    height: 75px; 
    padding: 0.5em;
    border: 1px solid #000;
    margin: 5px;
    background-color: #ccc;
    cursor: pointer;
}
.dynamic {
  background-color: #cfd;
  cursor: pointer;
}
 
$(document).ready(function() {
  $(".draggable").draggable();
  $("#addButton").click(function() {
    var $newElement = $("<div class='draggable dynamic'>Dynamic</div>");
  
    $(".container").append($newElement);
  
    $newElement.draggable();
  });
});
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers