Surendra Surendra -3 years ago 110
HTML Question

jQuery Draggable class finding

I have three classes in html tag. i gave draggable for one class. How can i know the class value.

<div class="drag dgtf hgyh">
//content
</div>

<div class="drop">
//content
</div>


Jquery as follows

$('.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
}
})

Answer Source

Get class of dropped element.

$('.drop').draggable({
  drop:function(event, ui){
      var draggable_class = ui.draggable[0].attr("class");
  }
})
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download