只要它不是当前的可拖动对象,我就可以让IE去除对象。这是在Chrome和Firefox上工作。有什么我做错了吗?
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://code.jquery.com/ui/jquery-ui-git.js"></script>
</head>
<body>
<ul id="list">
<li id="test-1" class="dropme">One</li>
<li id="test-2" class="dropme">Two</li>
</ul>
<div id="bucket" style="border:1px solid black">
<p>Drop items here and they should be removed.</p>
</div>
<script>
$("#list").sortable({
items: 'li'
});
$('#bucket').droppable({
drop: function(event, ui) {
$(ui.draggable).remove();
},
accept: '.dropme'
});
</script>
</body>
</html>
ui.draggable返回的是什么?在那个选择器中,它不需要是所有可拖动的DOM元素的字符串?如果它忽略了这一点,我在UI文档中找不到它。同样给页面一个DOCTYPE,因为IE很可能处于怪异模式,并且不能正常工作。 – Dormouse 2011-05-13 16:52:10
'ui.draggable'是大多数jQuery UI拖动事件中的当前拖动元素。实际上,它已经是一个jQuery对象,不需要执行'$(ui.draggable)'。 – DarthJDG 2011-05-13 17:01:34
@达思。谢谢,每天都是学生! – Dormouse 2011-05-13 17:06:45