从当前可拖动的
我如何从当前的 Draggabe 项目中获取 ID?
<style type="text/css">
.red{ color: #ff0000; }
</style>
<script type="text/javascript">
$(function() {
$(".dragg li").draggable();
$("#droppable").droppable({
hoverClass: 'red',
over: function(event, ui)
{
// $( --- ID FROM THE CURRENT DRAGABLE LI --- ).css('color','#ff0000');
},
out: function(event, ui)
{
// $( --- ID FROM THE CURRENT DRAGABLE LI --- ).css('color','#000000');
}
});
});
</script>
<div class="dragg">
<li id="b1">Drag me to my target</li>
<li id="b2">Drag me to my target</li>
<li id="b3">Drag me to my target</li>
</div>
<div id="droppable" style="border: 1px solid #000000;">
<br /><br />Drop here<br /><br />
</div>
亲切的问候 彼得
how can i get the ID from the current Draggabe Item?
<style type="text/css">
.red{ color: #ff0000; }
</style>
<script type="text/javascript">
$(function() {
$(".dragg li").draggable();
$("#droppable").droppable({
hoverClass: 'red',
over: function(event, ui)
{
// $( --- ID FROM THE CURRENT DRAGABLE LI --- ).css('color','#ff0000');
},
out: function(event, ui)
{
// $( --- ID FROM THE CURRENT DRAGABLE LI --- ).css('color','#000000');
}
});
});
</script>
<div class="dragg">
<li id="b1">Drag me to my target</li>
<li id="b2">Drag me to my target</li>
<li id="b3">Drag me to my target</li>
</div>
<div id="droppable" style="border: 1px solid #000000;">
<br /><br />Drop here<br /><br />
</div>
kind reagards
peter
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以通过
ui
参数的draggable
属性检索当前的可拖动项。要完成您的示例:
或者,如果您想要 ID:
You can retrieve the current draggable item through the
draggable
property of theui
argument.To complete your example:
Or, if you want the ID:
应该返回你的id。
Should return your id.