我正在使用 jquery draggable 并且正在处理停止事件。我需要知道被拖入的 LI 元素的 ID。我该怎么做?
最佳答案
ui
对象有 .helper
属性,表示被拖拽的 jQuery
对象。您可以通过以下方式从中检索元素的 id
:
stop: function(event, ui) {
alert( ui.helper[0].id ); // here it is
}
关于javascript - 我怎么知道通过 jquery 拖入了什么元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11684641/