我在 html 标签中有三个类。我给了一节课拖拽。我怎么知道类值。
<div class="drag dgtf hgyh">
//content
</div>
<div class="drop">
//content
</div>
jquery如下
$('.drag').draggable({
drag:function(){}
})
$('.drop').draggable({
drop:function(event, ui){
// here i need to get particular class which has drag
// that is how can i get 'drag' class name
}
})
最佳答案
尝试:
drop:function(event, ui){
ui.draggable.attr("id") // For ID
ui.draggable.attr("class") // For Class
}
更新:
ui.draggable.attr("class").split(' ')[0] // May be 1 or 2
关于jQuery Draggable 类查找,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41950846/