我试图动态地插入可拖动的div。目前我正在尝试插入页面加载。我稍后会把这个换成一个按钮。在页面加载中没有插入到我的容器中,我不明白为什么?
编辑:我固定了打印,因为别人指出,div被插入到页面,但div仍然不拖动,我不明白为什么?
//this makes elements with the draggable class draggable
<script>
$( function() {
$( ".draggable" ).draggable();
} );
//this inserts a draggable div on page load, will conert this to a button
//call function later once i get inserting draggable divs working
$(document).ready(function(){
$('#Container').append($("<div class='draggable'> This should be draggable</div>"));
});
</script>
</head>
<body>
<!-- Putting divs inside this Container --->
<div id="Container" style="border:solid; width:500px; height:500px;">
</div>